barnacle/
cli.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(author, version, about)]
6pub struct Cli {
7    /// Jinja2 template to render
8    #[arg()]
9    pub template: PathBuf,
10
11    /// The location to place the rendered file
12    #[arg()]
13    pub output: PathBuf,
14
15    /// The command + arguments to execute once template is rendered
16    #[arg(group = "command_or_exit", required(true))]
17    pub command: Vec<String>,
18
19    /// Exit with error code, exclusive with a command to exeute
20    #[arg(short, long, group = "command_or_exit", required(true))]
21    pub exit: Option<u8>,
22
23    /// Turn debugging information on
24    #[arg(short, long, action = clap::ArgAction::Count)]
25    pub verbose: u8,
26}