Skip to content

Commit

Permalink
Adding more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbor committed Jul 5, 2024
1 parent 682decb commit 4579227
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<JobDependency>,

/// Argument declarations
#[serde(default)]
args: Vec<String>,

/// Input files as space-separated list
#[serde(default)]
inputs: Option<String>,

/// Input files as native list
#[serde(default)]
input_list: Vec<String>,

/// Output files as space-separated list
#[serde(default)]
outputs: Option<String>,

/// Output files as native list
#[serde(default)]
output_list: Vec<String>,
}
Expand All @@ -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<String, String>,

/// Feed an argument by iterating over a space-separated list
#[serde(default)]
with_list: Option<WithList>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WithList {
/// Parameter name
param: String,

/// List of input values (space-separated)
#[serde(default)]
inputs: String,
}
Expand Down
14 changes: 10 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,

/// Number of jobs to run in parallel
/// number of jobs to run in parallel
#[clap(short, long)]
jobs: Option<usize>,

/// 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,
}
Expand All @@ -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<String, JobDescription>,
}

Expand Down

0 comments on commit 4579227

Please sign in to comment.