-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
49 lines (46 loc) · 1.17 KB
/
main.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
mod applications;
mod archives;
mod cli;
mod commands;
mod configuration;
mod download;
mod error;
mod filesystem;
mod hosting;
mod installation;
mod logging;
mod platform;
mod prelude;
mod regexp;
mod run;
mod yard;
use cli::Command;
#[cfg(test)]
pub(crate) use error::UserError;
use logging::Log;
use std::process::ExitCode;
fn main() -> ExitCode {
match inner() {
Ok(exitcode) => exitcode,
Err(err) => {
err.print();
ExitCode::FAILURE
}
}
}
fn inner() -> prelude::Result<ExitCode> {
let apps = applications::all();
match cli::parse(std::env::args(), &apps)? {
Command::AppsLong => Ok(commands::applications::long()),
Command::AppsShort => Ok(commands::applications::short()),
Command::Available(args) => commands::available(&args),
Command::RunApp(args) => commands::run(args),
Command::DisplayHelp => Ok(commands::help()),
Command::Setup => commands::setup(),
Command::Test(mut args) => commands::test(&mut args),
Command::Which(args) => commands::which(&args),
Command::Update(args) => commands::update(&args),
Command::Version => Ok(commands::version()),
Command::Versions(args) => commands::versions(&args),
}
}