-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.rs
58 lines (50 loc) · 1.21 KB
/
types.rs
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use clap::Parser;
use std::collections::HashMap;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about= None)]
pub(crate) struct Args {
/// Initial state to the input. For example "g" will go straight to the go_to mode.
#[arg(short, long, default_value_t = String::new())]
pub(crate) input: String,
}
pub(crate) enum SingleModeShortcuts {
Loading,
Loaded(State),
}
#[derive(Default, Debug, Clone)]
pub(crate) struct State {
pub(crate) input_value: String,
pub(crate) keymap: KeymapEntry,
}
#[derive(Clone, Debug)]
pub(crate) struct GoToOrLaunch {
pub(crate) workspace_name: &'static str,
pub(crate) instance_match: &'static str,
pub(crate) launch: Launch,
}
#[derive(Clone, Debug)]
pub(crate) struct Launch {
pub(crate) name: &'static str,
pub(crate) program: &'static str,
pub(crate) args: &'static [&'static str],
}
#[derive(Clone, Debug)]
pub(crate) enum Leaf {
GoToOrLaunch(GoToOrLaunch),
Launch(Launch),
LaunchNoQuit(Launch),
Quit,
}
#[derive(Clone, Debug)]
pub(crate) enum KeymapEntry {
Leaf(Leaf),
Node {
name: &'static str,
map: HashMap<&'static str, KeymapEntry>,
},
}
#[derive(Clone, Debug)]
pub(crate) enum Message {
Loaded(State),
InputChanged(String),
}