Closed reaganmcf closed 3 years ago
Note: We should actually also do some smart resolution here because cargo run
makes no sense for libraries.
If src/lib.rs
exists, then exec_commands should be cargo test
This is actually kind of tricky because for each subcommand of cargo
there are so many flags people probably want to use. Either we can support them, or just tell them to use shell
mode.
While I do think that's definitely the solution for very custom usages, I think we should support some popular flags, for example:
build
has many popular flags: --lib
, --bin name
, --features features
, --all-features
, --release
, --target-dir directory
, --out-dir directory
, etc.
Which ones should we support?
@alayshahh How do you think we should go about supporting the arguments to the subcommands. The linked PR has working subcommands but you can't pass any arguments into it yet, still waiting to figure out how we want to do this.
It might be a but difficult without the lightmon.toml file. If we can we can store args for the different cargo sub commands like this. Another adaptation we can have is take anything after the 'lightmon rust' arg and pass it to the command. If no args, we can just default to 'cargo run'
Yea because I don't want to not have some features and would rather have a dynamic way to allow all flags (current and new ones in the future).
For example, running lightmon rust doc --arg1 foo --bar bazz
would pass --arg1 foo --bar bazz
to cargo doc
without us having to specify the arguments explicitly in cli.yaml
@alayshahh The latest commit to the PR fixes this and makes the usage must more expressive and realistic.
Any subcommands after lightmon rust
get parsed using clap's AppSetting::ExternalSubcommands
global setting. This means the following:
lightmon rust build --bin my_bin --all-targets
Will resolve the exec command as cargo build --bin my_bin --all-targets
Currently,
lightmon rust
only supportscargo build
since that is howcli::build_rust_config()
works. But even while working on this project, I want to be able to docargo test
orcargo doc
without the shell script method. Being able to pass in the common cargo subcommands would be nice: