add comments
This commit is contained in:
parent
e8f7ef9876
commit
a1f948dfe3
|
@ -186,23 +186,31 @@ impl Execute {
|
||||||
command => command
|
command => command
|
||||||
.compile(options, global_state, function_state)
|
.compile(options, global_state, function_state)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|c| (true, prefix.clone() + "run " + &c))
|
.map(|c| map_run_cmd(c, &prefix))
|
||||||
.collect(),
|
.collect(),
|
||||||
},
|
},
|
||||||
Self::Runs(commands) if !require_grouping => commands
|
Self::Runs(commands) if !require_grouping => commands
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|c| c.compile(options, global_state, function_state))
|
.flat_map(|c| c.compile(options, global_state, function_state))
|
||||||
.map(|c| (true, prefix.clone() + "run " + &c))
|
.map(|c| map_run_cmd(c, &prefix))
|
||||||
.collect(),
|
.collect(),
|
||||||
Self::Runs(commands) => Command::Group(commands.clone())
|
Self::Runs(commands) => Command::Group(commands.clone())
|
||||||
.compile(options, global_state, function_state)
|
.compile(options, global_state, function_state)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|c| (true, prefix.clone() + "run " + &c))
|
.map(|c| map_run_cmd(c, &prefix))
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn map_run_cmd(cmd: String, prefix: &str) -> (bool, String) {
|
||||||
|
if cmd.starts_with('#') {
|
||||||
|
(false, cmd)
|
||||||
|
} else {
|
||||||
|
(true, prefix.to_string() + "run " + &cmd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn format_execute(
|
fn format_execute(
|
||||||
prefix: String,
|
prefix: String,
|
||||||
new: &str,
|
new: &str,
|
||||||
|
|
|
@ -22,6 +22,8 @@ pub enum Command {
|
||||||
Execute(Execute),
|
Execute(Execute),
|
||||||
/// Group of commands to be called instantly after each other
|
/// Group of commands to be called instantly after each other
|
||||||
Group(Vec<Command>),
|
Group(Vec<Command>),
|
||||||
|
/// Comment to be added to the function
|
||||||
|
Comment(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command {
|
impl Command {
|
||||||
|
@ -42,6 +44,7 @@ impl Command {
|
||||||
Self::Debug(message) => compile_debug(message, options),
|
Self::Debug(message) => compile_debug(message, options),
|
||||||
Self::Execute(ex) => ex.compile(options, global_state, function_state),
|
Self::Execute(ex) => ex.compile(options, global_state, function_state),
|
||||||
Self::Group(commands) => compile_group(commands, options, global_state, function_state),
|
Self::Group(commands) => compile_group(commands, options, global_state, function_state),
|
||||||
|
Self::Comment(comment) => vec!["#".to_string() + comment],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue