Closed brandongregoryscott closed 3 years ago
Started digging into this while building out a checklist for a recent PR. I think we will need to call the CLI itself to get the options for each command - because we've broken out each command into its own file, the top-level program doesn't know about any of the subcommand options. With the new Process.spawn
method, this shouldn't be too hard - albeit a bit slow, running synchronously + recursively through child commands.
We may even be able to repurpose/extract the TestUtils.executeCliCommand
which runs the async version of spawn
and knows how to build the path to the compiled JS.
Started digging into this while building out a checklist for a recent PR. I think we will need to call the CLI itself to get the options for each command - because we've broken out each command into its own file, the top-level program doesn't know about any of the subcommand options. With the new
Process.spawn
method, this shouldn't be too hard - albeit a bit slow, running synchronously + recursively through child commands.We may even be able to repurpose/extract the
TestUtils.executeCliCommand
which runs the async version ofspawn
and knows how to build the path to the compiled JS.
Depending upon the performance, it could be worth making this command cache by default. Where when run it generates a dot file (or something) and unless a no-cache
flag is provided to the command, it loads the file if the current version is the same as that of the cache file. Heck, could be a build artifact even
Oo, I like it 👍 That's true - it probably won't be changing that much that you'd need it on demand all of the time.
It might be nice to have a command to output a list of all commands, sub-commands, and their options. I found myself doing this to make a checklist for the Typescript port to make sure I'm not missing anything, but it could be nice to have a little debugging command to spit out this info for the future.
Preferably, it would output in some sort of indented tree, similar to the
tree
command for listing directory structures.This is what I ended up with (stripped out the command/option descriptions, but those could probably be included, or have the ability to exclude them)
This format allows for checkbox formatting in markdown, but the 'prefix' of the line could also be configurable.