Add '--debug' flag to print justfile with evaluated expressions and
variables
This commit is contained in:
parent
01df3d5e4a
commit
3c80f7f7ae
1
notes
1
notes
@ -3,7 +3,6 @@ notes
|
|||||||
|
|
||||||
- integration testing
|
- integration testing
|
||||||
. get value of variable --evaluate --variable
|
. get value of variable --evaluate --variable
|
||||||
. --info that prints whole justfile
|
|
||||||
. run app with command line options and test full output (stderr and stdout)
|
. run app with command line options and test full output (stderr and stdout)
|
||||||
. exercise all features and all command line options
|
. exercise all features and all command line options
|
||||||
. underline problem token in error messages
|
. underline problem token in error messages
|
||||||
|
@ -28,6 +28,9 @@ pub fn app() {
|
|||||||
.short("l")
|
.short("l")
|
||||||
.long("list")
|
.long("list")
|
||||||
.help("Lists available recipes"))
|
.help("Lists available recipes"))
|
||||||
|
.arg(Arg::with_name("debug")
|
||||||
|
.long("debug")
|
||||||
|
.help("Prints the justfile with debugging information, such as evaluated expression and assignment"))
|
||||||
.arg(Arg::with_name("show")
|
.arg(Arg::with_name("show")
|
||||||
.short("s")
|
.short("s")
|
||||||
.long("show")
|
.long("show")
|
||||||
@ -96,6 +99,11 @@ pub fn app() {
|
|||||||
|
|
||||||
let justfile = super::parse(&text).unwrap_or_else(|error| die!("{}", error));
|
let justfile = super::parse(&text).unwrap_or_else(|error| die!("{}", error));
|
||||||
|
|
||||||
|
if matches.is_present("debug") {
|
||||||
|
println!("{:#}", justfile);
|
||||||
|
process::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if matches.is_present("list") {
|
if matches.is_present("list") {
|
||||||
if justfile.count() == 0 {
|
if justfile.count() == 0 {
|
||||||
warn!("Justfile contains no recipes");
|
warn!("Justfile contains no recipes");
|
||||||
|
@ -644,7 +644,7 @@ impl<'a> Display for Justfile<'a> {
|
|||||||
}
|
}
|
||||||
items -= 1;
|
items -= 1;
|
||||||
if items != 0 {
|
if items != 0 {
|
||||||
try!(write!(f, "\n"));
|
try!(write!(f, "\n\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for recipe in self.recipes.values() {
|
for recipe in self.recipes.values() {
|
||||||
@ -655,7 +655,7 @@ impl<'a> Display for Justfile<'a> {
|
|||||||
}
|
}
|
||||||
items -= 1;
|
items -= 1;
|
||||||
if items != 0 {
|
if items != 0 {
|
||||||
try!(write!(f, "\n"));
|
try!(write!(f, "\n\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
10
src/tests.rs
10
src/tests.rs
@ -246,8 +246,11 @@ hello a b c : x y z #hello
|
|||||||
2
|
2
|
||||||
3
|
3
|
||||||
", "bar = foo # \"xx\"
|
", "bar = foo # \"xx\"
|
||||||
|
|
||||||
foo = \"xx\" # \"xx\"
|
foo = \"xx\" # \"xx\"
|
||||||
|
|
||||||
goodbye = \"y\" # \"y\"
|
goodbye = \"y\" # \"y\"
|
||||||
|
|
||||||
hello a b c: x y z
|
hello a b c: x y z
|
||||||
#! blah
|
#! blah
|
||||||
#blarg
|
#blarg
|
||||||
@ -255,8 +258,11 @@ hello a b c: x y z
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
|
|
||||||
x:
|
x:
|
||||||
|
|
||||||
y:
|
y:
|
||||||
|
|
||||||
z:");
|
z:");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +275,9 @@ b = "1"
|
|||||||
"#,
|
"#,
|
||||||
|
|
||||||
r#"a = "0" # "0"
|
r#"a = "0" # "0"
|
||||||
|
|
||||||
b = "1" # "1"
|
b = "1" # "1"
|
||||||
|
|
||||||
c = a + b + a + b # "0101""#);
|
c = a + b + a + b # "0101""#);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +309,7 @@ fn missing_eol() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn eof_test() {
|
fn eof_test() {
|
||||||
parse_summary("x:\ny:\nz:\na b c: x y z", "a b c: x y z\nx:\ny:\nz:");
|
parse_summary("x:\ny:\nz:\na b c: x y z", "a b c: x y z\n\nx:\n\ny:\n\nz:");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user