summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 5fab1d9..7c3829f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,7 @@ use nix::unistd;
extern crate time;
-// const ERROR_COMMAND: u8 = 1;
+const ERROR_ARGS: u8 = 1;
const ERROR_CONFIG: u8 = 2;
const ERROR_NO_USER: u8 = 3;
const ERROR_NOT_AUTHORIZED: u8 = 4;
@@ -18,7 +18,13 @@ mod help;
fn main() -> ExitCode {
let args: Vec<String> = env::args().collect();
- let flags = flags::parse(&args[1..]);
+ let flags = match flags::parse(&args[1..]) {
+ Some(data) => data,
+ None => {
+ help::help();
+ return ExitCode::from(ERROR_ARGS);
+ }
+ };
if flags.version {
println!("crab version 0.0.3");
return ExitCode::SUCCESS;
@@ -132,4 +138,4 @@ fn config(path: &str) -> Option<Config> {
users.push((user, persist));
}
Some(Config{users})
-} \ No newline at end of file
+}