Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: auto-generate docs #651

Merged
merged 11 commits into from
Oct 23, 2023
Merged

docs: auto-generate docs #651

merged 11 commits into from
Oct 23, 2023

Conversation

pendo324
Copy link
Member

@pendo324 pendo324 commented Oct 18, 2023

Issue #, if available:

Description of changes:

  • Add finch gen-docs generate command, which can be used to generate documentation
    • This actually runs all of the commands, so a finch vm needs to be running
      • This is because many of the commands shell out to nerdctl inside of a Linux VM, so simply leveraging cobra's built-in documentation generation won't work
      • Actually running the commands and then parsing the output into a markdown file is... kinda hacky, so this might break from time to time
  • This only works for top-level nerdctl commands right now, because those are the only commands that finch "knows" about. Meaning, while finch volume create is a command, with it's own usage information, it won't have a page here. The doc for finch volume does reference its subcommands, however.

Testing done:

  • TODO

    • unit tests
  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Signed-off-by: Justin Alvarez <[email protected]>
@pendo324 pendo324 added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 18, 2023
@pendo324 pendo324 requested a review from a team October 18, 2023 23:47
@pendo324 pendo324 self-assigned this Oct 18, 2023
Signed-off-by: Justin Alvarez <[email protected]>
@ningziwen
Copy link
Member

ningziwen commented Oct 19, 2023

Good to have a gen-docs-no-diff in ci.
Similar to

- run: git diff --exit-code

Signed-off-by: Justin Alvarez <[email protected]>
@pendo324
Copy link
Member Author

pendo324 commented Oct 20, 2023

The nature of this code makes it very hard to add more tests than what I've added in the latest commit. It both modifies os.Stdout, AND is recursive. I tried mocking out the scenario where there's a parent command and it does not seem worth the effort since this is not really a critical command anyway.

Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
Signed-off-by: Justin Alvarez <[email protected]>
KevinLiAWS
KevinLiAWS previously approved these changes Oct 23, 2023
cmd/finch/gen_docs.go Outdated Show resolved Hide resolved
vsiravar
vsiravar previously approved these changes Oct 23, 2023
Copy link
Contributor

@vsiravar vsiravar left a comment

Choose a reason for hiding this comment

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

Nice!

weikequ
weikequ previously approved these changes Oct 23, 2023
Copy link
Contributor

@weikequ weikequ left a comment

Choose a reason for hiding this comment

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

Left some small comments. Thanks for the good work!

cmd/finch/main_test.go Outdated Show resolved Hide resolved
docs/cmd/finch_help.md Show resolved Hide resolved
@pendo324 pendo324 dismissed stale reviews from weikequ and vsiravar via 567988b October 23, 2023 23:20
Copy link
Contributor

@weikequ weikequ left a comment

Choose a reason for hiding this comment

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

🚀

@pendo324
Copy link
Member Author

Skipping CI e2e tests take a long time and it's passed previously (these changes are unrelated to e2e tests)

@pendo324 pendo324 merged commit 3e25043 into runfinch:main Oct 23, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants