diff --git a/docs/scripts.md b/docs/scripts.md index addd7665..791e4a59 100644 --- a/docs/scripts.md +++ b/docs/scripts.md @@ -4,7 +4,7 @@ Scripts are used to extend the build process of your project. # Defining a Script Scripts use a list of shell commands. This small snippet is all that is needed to define a basic script. This example would be ran with `hemtt run build`. ```json -"script": { +"scripts": { "build": { "steps": [ "make all" @@ -15,7 +15,7 @@ Scripts use a list of shell commands. This small snippet is all that is needed t ### steps_windows / steps_linux `steps_windows` and `steps_linux` can be used to run different steps on the respective platforms. ```json -"script": { +"scripts": { "build": { "steps_linux": [ "make linux" @@ -30,7 +30,7 @@ Scripts use a list of shell commands. This small snippet is all that is needed t ### show_output All output is hidden by default. Setting `show_output` will display the command being executed and its output. ```json -"script": { +"scripts": { "example": { "steps": ["echo 'this is an example'"], "show_output": true @@ -45,7 +45,7 @@ There are 3 different build step definitions. `prebuild`, `postbuild` and `relea "releasebuild": [ "!build", ], -"script": { +"scripts": { "build": { "steps_linux": [ "make linux", @@ -72,7 +72,7 @@ In addition to the standard [templating variables](templating.md), additional va | time | | (build time in ms) | (build time in ms) | ```json -"script": { +"scripts": { "buildtime": { "steps": ["echo {{addon}} took {{time}} ms to build."], "show_output": true, diff --git a/src/project.rs b/src/project.rs index 9409e5ae..8b92fb08 100644 --- a/src/project.rs +++ b/src/project.rs @@ -59,7 +59,7 @@ pub struct Project { pub releasebuild: Vec, #[serde(skip_serializing_if = "HashMap::is_empty")] #[serde(default = "HashMap::new")] - pub script: HashMap, + pub scripts: HashMap, #[serde(skip_deserializing,skip_serializing)] pub template_data: BTreeMap<&'static str, String>, @@ -120,8 +120,8 @@ impl Project { } pub fn script(&self, name: &String, state: &State) -> Result<(), Error> { - if self.script.contains_key(name) { - let script = self.script.get(name).unwrap(); + if self.scripts.contains_key(name) { + let script = self.scripts.get(name).unwrap(); if script.foreach && state.stage == crate::state::Stage::Script { println!("Unable to run scripts with 'foreach' outside of build steps"); std::process::exit(1); @@ -157,7 +157,7 @@ pub fn init(name: String, prefix: String, author: String) -> Result