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

Generate documentation for command line interfaces #3816

Open
renancaraujo opened this issue Jul 8, 2024 · 3 comments
Open

Generate documentation for command line interfaces #3816

renancaraujo opened this issue Jul 8, 2024 · 3 comments
Labels
P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@renancaraujo
Copy link

Some people (like me) love publishing some command line apps on pub. Happens that often, such packages do not include a public API as code. Rather, the API is through commands and options to be executed in the terminal. Almost always using package:args.

To document such CLIs, maintainers must resource to the old ways and keep files such as the README up to date (manual work 😱).

It would be awesome if https://pub.dev/documentation/<package_name>/latest/ would also present pages with the commands available and their respective help message (often obtained via --help).

@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Jul 8, 2024
@srawlins
Copy link
Member

Cool idea. I think there could be some configuration that we could provide. Tricky to read the --help text of a script inside a package-being-documented... because you have to run the code to produce that text.

@srawlins srawlins added the P3 A lower priority bug or feature request label Jul 15, 2024
@renancaraujo
Copy link
Author

@srawlins you can obtain it programmatically if the CLI was built using package:args's CommandRunner, which keeps a tree of commands, subcommands, and options.
I did have to map that programatically to build cli_completion, so maybe dartdoc can use the same approach?

@srawlins
Copy link
Member

That's what I mean, I think. You cannot statically determine what command documentation is. You have to programmatically determine it (run the code), executing calls to addCommand etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants