diff --git a/src/app.rs b/src/app.rs index dc33e52..633d207 100644 --- a/src/app.rs +++ b/src/app.rs @@ -57,7 +57,22 @@ pub fn app() { .arg(Arg::with_name("list") .short("l") .long("list") - .help("Lists available recipes")) + .help("List available recipes") + .conflicts_with("dump") + .conflicts_with("show")) + .arg(Arg::with_name("dump") + .long("dump") + .help("Print entire justfile") + .conflicts_with("show") + .conflicts_with("list")) + .arg(Arg::with_name("show") + .short("s") + .long("show") + .takes_value(true) + .value_name("recipe") + .help("Show information about ") + .conflicts_with("dump") + .conflicts_with("list")) .arg(Arg::with_name("quiet") .short("q") .long("quiet") @@ -74,19 +89,13 @@ pub fn app() { .possible_values(&["auto", "always", "never"]) .default_value("auto") .help("Print colorful output")) - .arg(Arg::with_name("show") - .short("s") - .long("show") - .takes_value(true) - .value_name("recipe") - .help("Show information about ")) .arg(Arg::with_name("set") .long("set") .takes_value(true) .number_of_values(2) .value_names(&["variable", "value"]) .multiple(true) - .help("set to ")) + .help("Set to ")) .arg(Arg::with_name("working-directory") .long("working-directory") .takes_value(true) @@ -97,7 +106,7 @@ pub fn app() { .help("Use as justfile. --working-directory must also be set")) .arg(Arg::with_name("arguments") .multiple(true) - .help("recipe(s) to run, defaults to the first recipe in the justfile")) + .help("The recipe(s) to run, defaults to the first recipe in the justfile")) .get_matches(); // it is not obvious to me what we should do if only one of --justfile and @@ -178,6 +187,11 @@ pub fn app() { process::exit(0); } + if matches.is_present("dump") { + println!("{}", justfile); + process::exit(0); + } + if let Some(name) = matches.value_of("show") { match justfile.get(name) { Some(recipe) => { diff --git a/src/integration.rs b/src/integration.rs index ed6a1d2..f37576e 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -266,29 +266,6 @@ recipe: "", ); } -/* -#[test] -fn debug() { - let text = -r#"hello = "foo" -bar = hello + hello -recipe: - echo {{hello + "bar" + bar}}"#; - integration_test( - &["--debug"], - text, - 0, - r#"bar = hello + hello # "foofoo" - -hello = "foo" # "foo" - -recipe: - echo {{hello + "bar" + bar # "foobarfoofoo"}} -"#, - "", - ); -} -*/ #[test] fn status_passthrough() { @@ -971,3 +948,19 @@ recipe: ); } +#[test] +fn dump() { + let text =" +recipe: + @exit 100"; + integration_test( + &["--dump"], + text, + 0, + "recipe: + @exit 100 +", + "", + ); +} +