pattobrien / cli-gen Goto Github PK
View Code? Open in Web Editor NEWCreate type-safe CLI apps with the help of code generation.
License: MIT License
Create type-safe CLI apps with the help of code generation.
License: MIT License
Hi @pattobrien, first excellent job in the package; this looks good!
I might be adding some issues or requests here based on common CLI problems that might fall under the scope of this package.
Make the auto generation of the CLI version and command more effortless and seamless.
CLIs need to easily check the version. This is used for update checking, compatibility, user support, and so on. Right now, most have to use build_version or a custom script (my case) in order to write the version value from pubspec.
@cliRunner
should allow for top level options similar to the @cliCommand
, so we can have $ cmd --version
which is "somewhat" the standard.The top level arguments its important on the runner as that is the way also we can configfure global arguments for all commands, or log levels like --verbose
and so on.
We already have dedicated models that represent each element of cli_gen
(e.g. CliCommandModel
) which is essentially a trimmed down version of the Element/AST model, that can be easily used by any code generator.
It would be very useful to have users tap into these builders to define their own static html / js help docs, similar to the FVM docs which were written by hand:
https://fvm.app/documentation/guides/basic-commands
The above docs include the following details for each command (the table shows what is already supported by cli gen today).
Detail | Is Already Supported |
---|---|
Command name | ✅ |
Description | ✅ |
Usage | |
Detailed description | |
Examples | |
Options | ✅ |
Most of the information, besides the examples, would be easy to support.
The biggest question is how to support html/js generation, as rolling our own generator just for cli_gen
would not have much benefit as, say, creating a more general-purpose generator for other packages to use. Dartdoc sort of fits this use case, but likely does not support the amount of customization that developers want.
Needs further investigation.
❯ dart bin/main.dart stash apply --help
Commands for managing a stack of stashed changes.
Usage: git stash <subcommand> [arguments]
-h, --help Print this usage information.
Available subcommands:
apply Apply the stash at the given [stashRef] to the working directory.
my-custom-command Save your local modifications to a new stash.
Run "git help" to see global options.
A known issue is that a ParameterElement
(i.e declarations) of Functions and Methods does not have access to its doc comments via the Element model. Only Constructor parameters are able to access doc comments, but of the Fields or Super parameters that they represent. The lack of support for documenting parameters specifically is likely because Dart recommends against documenting parameters one by one.
There are a couple solutions that we could implement to work around this limitation, none of which are perfect, especially when considering the initial cli-gen
+ macros
prototype.
This is a 100% usable solution for build_runner
cli-gen
, but not for macros, since macros do not have access to the Ast model (note: macros API limitations is unconfirmed).
Extremely inelegant solution, this would be a last resort
We'd love some feedback from the community on how doc comments are used in general; how they're utilized in practice may have an effect on which option is selected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.