cargo_workflows/
lib.rs

1#![no_std]
2
3extern crate alloc;
4extern crate std;
5
6use std::{io::Write, process::exit};
7
8use alloc::boxed::Box;
9
10pub mod args;
11pub mod run;
12pub mod workflow_getter;
13
14/// Creates a new workflows.toml file from a template
15fn create_workflows_file() -> Result<(), std::io::Error> {
16    let mut file = std::fs::File::create("workflows.toml")?;
17
18    file.write_all(include_str!("../text/workflows.toml").as_bytes())?;
19
20    Ok(())
21}
22
23/// Runs this program
24pub fn main() -> Result<(), Box<dyn std::error::Error>> {
25    let args = args::Args::parse();
26
27    match args.subcmd {
28        args::SubCommandEnum::Run(workflow) => run::run(&workflow.workflow, workflow.debug)?,
29        args::SubCommandEnum::Init(_) => create_workflows_file()?,
30    }
31
32    exit(0)
33}