rusty_cli/flags/flag.rs
1use std::collections::HashMap;
2
3/// Defines the base structure of flags in a command
4pub type Flags = HashMap<String, Option<String>>;
5
6#[derive(Clone)]
7pub struct Flag {
8 /// The identifier of a flag
9 pub(crate) id: String,
10 /// The shorthands of a flag
11 pub(crate) shorthands: Vec<String>,
12 /// If the flag has arguments
13 pub(crate) has_arguments: bool
14}
15
16impl Flag {
17
18 /// Creates a new flag that can be used in the system
19 /// for providing data
20 pub fn new(id: String, shorthands: Vec<String>, has_arguments: bool) -> Self {
21 Flag {id, shorthands, has_arguments}
22 }
23}