Skip to content

Commit 0547a7e

Browse files
committed
added --include/-i to cli to include external files (#407)
1 parent 2854816 commit 0547a7e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/cli.rs

+26
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ pub struct CompileParameters {
103103

104104
#[structopt(long, name = "sysroot", help = "Path to system root, used for linking")]
105105
pub sysroot: Option<String>,
106+
107+
#[structopt(
108+
name = "include",
109+
long,
110+
short = "i",
111+
min_values = 1,
112+
help = "Include .st files for external functions"
113+
)]
114+
pub include_files: Vec<String>,
106115
}
107116

108117
fn parse_encoding(encoding: &str) -> Result<&'static Encoding, String> {
@@ -448,4 +457,21 @@ mod cli_tests {
448457
.unwrap();
449458
assert_eq!(parameters.sysroot, Some("path/to/sysroot".to_string()));
450459
}
460+
461+
#[test]
462+
fn include_files_added() {
463+
let parameters = CompileParameters::parse(vec_of_strings!(
464+
"input.st",
465+
"-i",
466+
"include1",
467+
"include2",
468+
"--include",
469+
"include3"
470+
))
471+
.unwrap();
472+
assert_eq!(
473+
parameters.include_files,
474+
vec!["include1", "include2", "include3"]
475+
);
476+
}
451477
}

0 commit comments

Comments
 (0)