Closed brettz9 closed 5 years ago
I do agree this would be useful but it's not something I plan to implement as part of this package. I recommend building a separate tool which takes command-line-usage output as input - let me know if you build it, cheers.
Thanks to ansi-to-svg
, just took a few lines to get an image out of your output (is that what you used?). Result for my simple formatting: https://github.com/brettz9/git-utilities#command-line-usage
Anyways, not sure how well-supported the necessary CSS would be within Markdown.
import fs from 'fs';
import ansiToSVG from 'ansi-to-svg';
import commandLineUsage from 'command-line-usage';
import {cliSections} from '../src/optionDefinitions.mjs'; // My command-line-usage data
const {promises: {writeFile}} = fs;
const ansiText = commandLineUsage(cliSections);
(async () => {
await writeFile(
new URL('../cli.svg', import.meta.url).pathname,
ansiToSVG(ansiText)
);
})();
I just use simple html tags, example here.
Oh, sorry, I was referring to your image files like: https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/synopsis.png . These can be automatically built--(in my example with SVG, but there is also one for PNG/JPEG: https://github.com/F1LT3R/ansi-to-image ). Not as nice as cut-and-pasteable text, but it at least is automatable and preserves the styling.
ah, ok - they are just screenshots.. thanks for sharing the ansi-to-svg example 👍
FWIW, I've now published a tool for exporting command-line-usage
arrays to HTML or SVG here: https://github.com/brettz9/command-line-publish (CLI or programmatic)
FWIW, I've now published a tool for exporting
command-line-usage
arrays to HTML or SVG here: https://github.com/brettz9/command-line-publish (CLI or programmatic)
This is great, thank you!
I think it'd be handy if you could provide an out-of-the-box solution for converting the usage options into Markdown, e.g., for inclusion in a README. I know it should not be too hard to parse it oneself, but it could be handy, e.g,. for italicizing, if this were all done for us... :)