mirror of
https://github.com/fanzeyi/cargo-play
synced 2024-11-13 22:47:06 +00:00
use last
for args and improve documents for command line options
This commit is contained in:
parent
4fdc7ca414
commit
961b74b95e
1 changed files with 11 additions and 3 deletions
14
src/opt.rs
14
src/opt.rs
|
@ -37,11 +37,15 @@ impl Into<String> for RustEdition {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
#[structopt(name = "cargo-play", about = "Single file cargo runner.")]
|
#[structopt(
|
||||||
|
name = "cargo-play",
|
||||||
|
about = "Run your Rust program without Cargo.toml"
|
||||||
|
)]
|
||||||
pub(crate) struct Opt {
|
pub(crate) struct Opt {
|
||||||
#[structopt(short = "d", long = "debug", hidden = true)]
|
#[structopt(short = "d", long = "debug", hidden = true)]
|
||||||
debug: bool,
|
debug: bool,
|
||||||
#[structopt(short = "c", long = "clean")]
|
#[structopt(short = "c", long = "clean")]
|
||||||
|
/// Rebuild the cargo project without the cache from previous run
|
||||||
pub clean: bool,
|
pub clean: bool,
|
||||||
#[structopt(short = "t", long = "toolchain", hidden = true)]
|
#[structopt(short = "t", long = "toolchain", hidden = true)]
|
||||||
pub toolchain: Option<String>,
|
pub toolchain: Option<String>,
|
||||||
|
@ -49,6 +53,7 @@ pub(crate) struct Opt {
|
||||||
parse(try_from_os_str = "osstr_to_abspath"),
|
parse(try_from_os_str = "osstr_to_abspath"),
|
||||||
raw(required = "true", validator = "file_exist")
|
raw(required = "true", validator = "file_exist")
|
||||||
)]
|
)]
|
||||||
|
/// Paths to your source code files
|
||||||
pub src: Vec<PathBuf>,
|
pub src: Vec<PathBuf>,
|
||||||
#[structopt(
|
#[structopt(
|
||||||
short = "e",
|
short = "e",
|
||||||
|
@ -56,12 +61,15 @@ pub(crate) struct Opt {
|
||||||
default_value = "2018",
|
default_value = "2018",
|
||||||
raw(possible_values = r#"&["2015", "2018"]"#)
|
raw(possible_values = r#"&["2015", "2018"]"#)
|
||||||
)]
|
)]
|
||||||
|
/// Specify Rust edition
|
||||||
pub edition: RustEdition,
|
pub edition: RustEdition,
|
||||||
#[structopt(long = "release")]
|
#[structopt(long = "release")]
|
||||||
|
/// Build program in release mode
|
||||||
pub release: bool,
|
pub release: bool,
|
||||||
#[structopt(long = "cached")]
|
#[structopt(long = "cached", hidden = true)]
|
||||||
pub cached: bool,
|
pub cached: bool,
|
||||||
#[structopt(short = "a", long = "arg", multiple = true)]
|
#[structopt(multiple = true, last = true)]
|
||||||
|
/// Arguments passed to the underlying program
|
||||||
pub args: Vec<String>,
|
pub args: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue