spectre.console
spectre.console copied to clipboard
Export for Documentation
I'm currently manually creating the documentation to put on my site for the CLI usage. Which gave me a thought...
Would it be possible to do some sort of export of the the documentation.
If I have branch commands I have to go into each command and call -h
to get the output for that command, then I use that to build the documentation on the site.
I have no idea how you would solve it nicely, maybe a nuget tool which analysis it and generates a .md file.
Feel free to close this is my idea is stupid...
A little hidden gem of Spectre.Console.Cli is that you can export XML structure with a hidden command.
Try passing cli xmldoc
to your application and it should give you the XML structure:

You can use this XML to generate documentation for your app.
Other than lacking Description and Examples, this is awesome!
explain
is really nice for being able to view the branches and check that descriptions and examples have been written.
We could add description and examples to the xmldoc output.
I don't mind trying to do a PR next week if you can point me in the right direction.
@phillip-haydon The command you would want to extend is the XmlDocCommand
which can be found here: https://github.com/spectreconsole/spectre.console/blob/main/src/Spectre.Console.Cli/Internal/Commands/XmlDocCommand.cs
I don't mind trying to do a PR next week if you can point me in the right direction.
Still interested in preparing a PR for this @phillip-haydon? If so, I can make myself available to review with a view to merging.
Hey, would still love this, no time at the moment :(.
@FrankRay78 I have implemented the feature in #1503. Could you please review it?