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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
use crate::cmd;
use crate::options;
use crate::workspaces::Workspace;
use structopt::StructOpt;
use structopt::clap::{AppSettings, Shell};
use sn0int_common::ModuleID;
#[derive(Debug, StructOpt)]
#[structopt(global_settings = &[AppSettings::ColoredHelp])]
pub struct Args {
#[structopt(short="w", long="workspace", env="SN0INT_WORKSPACE")]
pub workspace: Option<Workspace>,
#[structopt(subcommand)]
pub subcommand: Option<SubCommand>,
}
impl Args {
pub fn is_sandbox(&self) -> bool {
matches!(self.subcommand, Some(SubCommand::Sandbox(_)))
}
}
#[derive(Debug, StructOpt)]
pub enum SubCommand {
#[structopt(name="run")]
Run(Run),
#[structopt(name="sandbox")]
Sandbox(Sandbox),
#[structopt(name="login")]
Login(Login),
#[structopt(name="new")]
New(New),
#[structopt(name="publish")]
Publish(Publish),
#[structopt(name="install")]
Install(Install),
#[structopt(name="search")]
Search(Search),
#[structopt(name="pkg")]
Pkg(cmd::pkg_cmd::Args),
#[structopt(name="add")]
Add(cmd::add_cmd::Args),
#[structopt(name="select")]
Select(cmd::select_cmd::Args),
#[structopt(name="delete")]
Delete(cmd::delete_cmd::Args),
#[structopt(name="activity")]
Activity(cmd::activity_cmd::Args),
#[structopt(name="scope")]
Scope(cmd::scope_cmd::Args),
#[structopt(name="noscope")]
Noscope(cmd::noscope_cmd::Args),
Autoscope(cmd::autoscope_cmd::Args),
Autonoscope(cmd::autonoscope_cmd::Args),
Rescope(cmd::rescope_cmd::Args),
#[structopt(name="workspace")]
Workspace(cmd::workspace_cmd::Args),
#[structopt(name="cal")]
Cal(cmd::cal_cmd::Args),
#[structopt(name="notify")]
Notify(cmd::notify_cmd::Args),
#[structopt(name="fsck")]
Fsck(cmd::fsck_cmd::Args),
#[structopt(name="export")]
Export(cmd::export_cmd::Args),
#[structopt(name="stats")]
Stats(cmd::stats_cmd::Args),
#[structopt(name="repl")]
Repl,
#[structopt(name="paths")]
Paths,
#[structopt(name="completions")]
Completions(Completions),
}
#[derive(Debug, StructOpt)]
pub struct Run {
#[structopt(flatten)]
pub run: cmd::run_cmd::Args,
#[structopt(short="f", long="file")]
pub file: bool,
#[structopt(long="stdin")]
pub stdin: bool,
#[structopt(long="grant")]
pub grants: Vec<String>,
#[structopt(long="grant-full-keyring")]
pub grant_full_keyring: bool,
#[structopt(long="deny-keyring")]
pub deny_keyring: bool,
#[structopt(short="x", long="exit-on-error")]
pub exit_on_error: bool,
#[structopt(short="o", long="option")]
pub options: Vec<options::Opt>,
#[structopt(short="t", long="target")]
pub target: Option<String>,
#[structopt(long="dump-sandbox-init-msg")]
pub dump_sandbox_init_msg: bool,
}
#[derive(Debug, StructOpt)]
pub struct Sandbox {
_label: String,
}
#[derive(Debug, StructOpt)]
pub struct Login {
}
#[derive(Debug, StructOpt)]
pub struct New {
pub path: String,
}
#[derive(Debug, StructOpt)]
pub struct Publish {
#[structopt(required = true)]
pub paths: Vec<String>,
}
#[derive(Debug, StructOpt)]
pub struct Install {
pub module: ModuleID,
pub version: Option<String>,
#[structopt(short="f", long="force")]
pub force: bool,
}
#[derive(Debug, StructOpt)]
pub struct Search {
#[structopt(long="new")]
pub new: bool,
pub query: String,
}
#[derive(Debug, StructOpt)]
pub struct Completions {
#[structopt(possible_values=&Shell::variants())]
pub shell: Shell,
}