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
33
34
35
36
37
38
crate::ix!();

impl ArgsManagerInner {

    /**
      | Get the command and command args (returns
      | std::nullopt if no command provided)
      |
      */
    pub fn get_command(&self) -> Option<ArgsManagerCommand> {
        
        let mut ret = ArgsManagerCommand::default();

        if self.command.is_empty() {
            // No command was passed
            return None;
        }

        let mut it = self.command.iter();

        if !self.accept_any_command {

            // The registered command
            ret.command = Some(it.as_slice()[0].clone());

            it.next();
        }

        while let Some(item) = it.next() {

            // The unregistered command and args
            // (if any)
            ret.args.push(item.to_string());
        }

        Some(ret)
    }
}