Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

feature: add gen-doc command to auto gen dfget cli docs #312

Merged
merged 1 commit into from
Jan 16, 2019

Conversation

allencloud
Copy link
Contributor

Signed-off-by: Allen Sun [email protected]

Ⅰ. Describe what this PR did

How to generate user-friendly document is very important work we have to do in Dragonfly project. While I think the best way to make it is to follow the rule CODE IS DOCUMENT(代码即文档). Under such kind of policy, when every update occurs to the CLI-related code, the project has abilities to auto generate the corresponding document. Then the developers can spend less time to construct the document, instead they could have more time to polish the CLI related code when programming which is also reasonable.

We have already supported using spf13/cobra to implement COMMAND LINE framework in dragonflyoss/dragonfly#257. With this work, we can use https://github.com/spf13/cobra/blob/master/doc/md_docs.md to add another command to generate all the CLI document.

After adding the command which is used to generate CLI document, we can make @pouchrobot to automatically generate doc every day when it has update to the cli part. This is quite similar to PouchContainer.

Ⅱ. Does this pull request fix one issue?

fix dragonflyoss/dragonfly#306

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

no need

Ⅳ. Describe how to verify it

none

Ⅴ. Special notes for reviews

none

@allencloud
Copy link
Contributor Author

After PR pouchcontainer/pouchrobot#100 is merged, we could make @pouchrobot to support auto generate cli documentation.

@allencloud allencloud force-pushed the auto-gen-markdown branch 2 times, most recently from 8945ede to 9dba3c6 Compare January 7, 2019 17:43
@codecov-io
Copy link

codecov-io commented Jan 7, 2019

Codecov Report

Merging #312 into master will decrease coverage by 0.01%.
The diff coverage is 47.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #312      +/-   ##
==========================================
- Coverage   58.19%   58.17%   -0.02%     
==========================================
  Files          31       32       +1     
  Lines        1794     1810      +16     
==========================================
+ Hits         1044     1053       +9     
- Misses        709      716       +7     
  Partials       41       41
Impacted Files Coverage Δ
cmd/dfget/app/root.go 71.54% <ø> (+1.38%) ⬆️
cmd/dfget/app/gen_doc.go 47.05% <47.05%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05f077d...da7d326. Read the comment docs.

@starnop
Copy link
Contributor

starnop commented Jan 8, 2019

Please rebase the master branch after dragonflyoss/dragonfly#305 merged.

@allencloud
Copy link
Contributor Author

PTAL @starnop

title: "dfget"
weight: 5
---
## dfget
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the difference between this file and the auto-generated file?

```

## Files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe we need the documentation about the configuration file. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can split that from the dfget.md.

rootCmd.AddCommand(genDocCommand.cmd)
}

func (g *GenDocCommand) runGenDoc(args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please implement the related part of dfdaemon by he way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will do that in a separate PR.

@allencloud
Copy link
Contributor Author

I am wondering if we could add a new subcommand of dfget pull for dfget. Then it would be much clearer for the usage of dfget. @lowzj @starnop

@lowzj lowzj merged commit 1b19d57 into dragonflyoss:master Jan 16, 2019
@allencloud allencloud deleted the auto-gen-markdown branch January 16, 2019 03:18
starnop pushed a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
feature: add gen-doc command to auto gen dfget cli docs
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
feature: add gen-doc command to auto gen dfget cli docs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] use "spf13/cobra" to auto generate command line markdown document
5 participants