Skip to content

Commit

Permalink
Merge pull request #65 from dfinance/script-args
Browse files Browse the repository at this point in the history
script args cli parameter
  • Loading branch information
mkurnikov authored May 22, 2020
2 parents f808de0 + 39c78c7 commit 8146764
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/move-executor/src/bin/executor_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ fn main() -> Result<()> {
Arg::from_usage("--genesis [GENESIS_JSON_FILE]")
.help("Path to .json file to use as pre-loaded chain state"),
)
.arg(
Arg::from_usage("--args [SCRIPT_ARGS]")
.multiple(true)
.help("Number of script main() function arguments"),
)
.get_matches();

let script_fpath = leaked_fpath(cli_arguments.value_of("SCRIPT").unwrap());
Expand All @@ -74,14 +79,20 @@ fn main() -> Result<()> {

let dialect = cli_arguments.value_of("dialect").unwrap();
let sender_address = cli_arguments.value_of("sender").unwrap();
let args: Vec<String> = cli_arguments
.value_of("args")
.unwrap_or_default()
.split_ascii_whitespace()
.map(String::from)
.collect();

let res = compile_and_execute_script(
(script_fpath, script_source_text.clone()),
&deps,
dialect,
sender_address,
genesis_json_contents,
vec![],
args,
);
match res {
Ok(changes) => {
Expand Down

0 comments on commit 8146764

Please sign in to comment.