add comments
This commit is contained in:
parent
e8f7ef9876
commit
a1f948dfe3
|
@ -186,23 +186,31 @@ impl Execute {
|
|||
command => command
|
||||
.compile(options, global_state, function_state)
|
||||
.into_iter()
|
||||
.map(|c| (true, prefix.clone() + "run " + &c))
|
||||
.map(|c| map_run_cmd(c, &prefix))
|
||||
.collect(),
|
||||
},
|
||||
Self::Runs(commands) if !require_grouping => commands
|
||||
.iter()
|
||||
.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(),
|
||||
Self::Runs(commands) => Command::Group(commands.clone())
|
||||
.compile(options, global_state, function_state)
|
||||
.into_iter()
|
||||
.map(|c| (true, prefix.clone() + "run " + &c))
|
||||
.map(|c| map_run_cmd(c, &prefix))
|
||||
.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(
|
||||
prefix: String,
|
||||
new: &str,
|
||||
|
|
|
@ -22,6 +22,8 @@ pub enum Command {
|
|||
Execute(Execute),
|
||||
/// Group of commands to be called instantly after each other
|
||||
Group(Vec<Command>),
|
||||
/// Comment to be added to the function
|
||||
Comment(String),
|
||||
}
|
||||
|
||||
impl Command {
|
||||
|
@ -42,6 +44,7 @@ impl Command {
|
|||
Self::Debug(message) => compile_debug(message, options),
|
||||
Self::Execute(ex) => ex.compile(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