Skip to content

Commit 8d72c85

Browse files
author
replydev
committed
Init sodiumoxide
1 parent 1106478 commit 8d72c85

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/main.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod utils;
55
mod argument_functions;
66
mod otp_helper;
77
mod cryptograpy;
8+
use sodiumoxide;
89

910
#[cfg(debug_assertions)]
1011
fn print_title(version: &str){
@@ -19,9 +20,21 @@ fn print_title(version: &str){
1920
println!("written by @replydev\n");
2021
}
2122

23+
fn init() -> Result<(), ()>{
24+
sodiumoxide::init()
25+
}
26+
2227
fn main() {
2328
let version = "0.0.6";
2429
print_title(version);
30+
let init_result = init();
31+
match init_result {
32+
Ok(()) => println!("sodiumoxide init succeeded"),
33+
Err(()) => {
34+
println!("Failed to init sodiumoxide");
35+
return;
36+
}
37+
}
2538
let args: Vec<String> = env::args().collect();
2639
if !args_parser(args){
2740
utils::create_db_if_needed();
@@ -35,12 +48,12 @@ fn args_parser(args: Vec<String>) -> bool {
3548
}
3649

3750
match &args[1][..]{
38-
"-i" | "--import" =>{argument_functions::import(args);},
39-
"-h" | "--help" =>{argument_functions::help();},
40-
"-a" | "--add" =>{argument_functions::add(args);},
41-
"-r" | "--remove" =>{argument_functions::remove(args);},
42-
"-e" | "--edit" =>{argument_functions::edit(args);},
43-
"-ex" | "--export" =>{argument_functions::export(args);},
51+
"-i" | "--import" => argument_functions::import(args),
52+
"-h" | "--help" => argument_functions::help(),
53+
"-a" | "--add" => argument_functions::add(args),
54+
"-r" | "--remove" => argument_functions::remove(args),
55+
"-e" | "--edit" => argument_functions::edit(args),
56+
"-ex" | "--export" => argument_functions::export(args),
4457
_=>{
4558
println!("Invalid argument: {}, type cotp -h to get command options", args[1]);
4659
return true;

0 commit comments

Comments
 (0)