Skip to main content

oo_ide/commands/
args.rs

1use std::borrow::Cow;
2use std::path::PathBuf;
3
4#[derive(Debug, Clone)]
5#[allow(dead_code)]
6pub enum ArgKind {
7    String,
8    Bool,
9    Int,
10    FilePath,
11    Choice(Vec<Cow<'static, str>>),
12}
13
14#[derive(Debug, Clone)]
15pub struct CommandArg {
16    pub name: Cow<'static, str>,
17    pub description: Cow<'static, str>,
18    pub kind: ArgKind,
19    pub required: bool,
20}
21
22impl CommandArg {
23    #[allow(dead_code)]
24    pub fn new(
25        name: impl Into<Cow<'static, str>>,
26        description: impl Into<Cow<'static, str>>,
27        kind: ArgKind,
28        required: bool,
29    ) -> Self {
30        Self {
31            name: name.into(),
32            description: description.into(),
33            kind,
34            required,
35        }
36    }
37}
38
39#[derive(Debug, Clone, PartialEq)]
40pub enum ArgValue {
41    String(String),
42    Bool(bool),
43    Int(i64),
44    FilePath(PathBuf),
45}