1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::{CommandArgs, IntoArgs};

pub fn cmd(name: &'static str) -> Command {
    Command::new(name)
}

#[derive(Debug)]
pub struct Command {
    pub name: &'static str,
    pub args: CommandArgs,
}

impl Command {
    pub fn new(name: &'static str) -> Self {
        Self {
            name,
            args: CommandArgs::Empty,
        }
    }

    pub fn arg<A>(self, args: A) -> Self
    where
        A: IntoArgs,
    {
        Self {
            name: self.name,
            args: args.into_args(self.args),
        }
    }
}