spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Export for Documentation

Open phillip-haydon opened this issue 2 years ago • 7 comments

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...

phillip-haydon avatar Dec 21 '22 11:12 phillip-haydon

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:

image

You can use this XML to generate documentation for your app.

patriksvensson avatar Dec 21 '22 12:12 patriksvensson

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.

phillip-haydon avatar Dec 21 '22 15:12 phillip-haydon

We could add description and examples to the xmldoc output.

patriksvensson avatar Dec 21 '22 15:12 patriksvensson

I don't mind trying to do a PR next week if you can point me in the right direction.

phillip-haydon avatar Dec 21 '22 15:12 phillip-haydon

@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

patriksvensson avatar Jan 02 '23 11:01 patriksvensson

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.

FrankRay78 avatar May 17 '23 11:05 FrankRay78

Hey, would still love this, no time at the moment :(.

phillip-haydon avatar May 17 '23 12:05 phillip-haydon

@FrankRay78 I have implemented the feature in #1503. Could you please review it?

yenneferofvengerberg avatar Mar 29 '24 19:03 yenneferofvengerberg