Skip to content

Commit

Permalink
revert old cli
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Apr 27, 2019
1 parent 62b5ecd commit 381f3af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ pub fn create_cli_app<'a, 'b>() -> App<'a, 'b> {
// entry point script
SubCommand::with_name("<script>").about("Script to run"),
),
).subcommand(
// this is a fake subcommand - it's used in conjunction with
// AppSettings:AllowExternalSubcommand to treat it as an
// entry point script
SubCommand::with_name("<script>").about("Script to run"),
)
}
/// Parse ArgMatches into internal DenoFlags structure.
Expand Down
14 changes: 14 additions & 0 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,20 @@ fn main() {
_ => unreachable!(),
}
}
(script, Some(script_match)) => {
argv.extend(vec![script.to_string()]);
// check if there are any extra arguments that should
// be passed to script
if script_match.is_present("") {
let script_args: Vec<String> = script_match
.values_of("")
.unwrap()
.map(String::from)
.collect();
argv.extend(script_args);
}
run_script(flags, argv);
}
_ => {
run_repl(flags, argv);
}
Expand Down

0 comments on commit 381f3af

Please sign in to comment.