diff --git a/src/job.rs b/src/job.rs index 069550d..0f9260e 100644 --- a/src/job.rs +++ b/src/job.rs @@ -17,24 +17,33 @@ use crate::Options; /// Template for a job as described in the Zinnfile #[derive(Clone, Debug, Serialize, Deserialize)] pub struct JobDescription { + /// The shell commands to run for this job #[serde(default)] run: String, + /// Dependencies of the job + /// + /// See also [`JobDependency`]. #[serde(default)] requires: Vec, + /// Argument declarations #[serde(default)] args: Vec, + /// Input files as space-separated list #[serde(default)] inputs: Option, + /// Input files as native list #[serde(default)] input_list: Vec, + /// Output files as space-separated list #[serde(default)] outputs: Option, + /// Output files as native list #[serde(default)] output_list: Vec, } @@ -52,19 +61,24 @@ pub struct InnerJobRealization { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct JobDependency { + /// Name of the dependency job job: String, + /// Arguments to pass to the dependency job #[serde(default)] with: HashMap, + /// Feed an argument by iterating over a space-separated list #[serde(default)] with_list: Option, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct WithList { + /// Parameter name param: String, + /// List of input values (space-separated) #[serde(default)] inputs: String, } diff --git a/src/main.rs b/src/main.rs index b6ad7d6..265c37e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,19 +30,19 @@ struct Args { #[clap(short, long, default_value_t = String::from("zinn.yaml"))] file: String, - /// Target jobs to execute as entry points + /// target jobs to execute as entry points #[clap(default_values_t = [String::from("default")])] targets: Vec, - /// Number of jobs to run in parallel + /// number of jobs to run in parallel #[clap(short, long)] jobs: Option, - /// Print output of jobs + /// print output of jobs #[clap(short, long)] verbose: bool, - /// Force rebuild all files + /// force rebuild all files #[clap(short = 'B', long)] force_rebuild: bool, } @@ -56,10 +56,16 @@ struct Options { #[derive(Clone, Debug, Serialize, Deserialize)] struct Zinnfile { + /// Constants to pass to the jobs + /// + /// All constants are rendered, with all previous constants being available. #[serde(default)] #[serde(deserialize_with = "constants::parse")] constants: Vec<(String, String)>, + /// Descriptions of the jobs + /// + /// See also [`JobDescription`]. jobs: HashMap, }