diff options
| author | Mel <einebeere@gmail.com> | 2021-09-20 17:36:40 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-09-20 17:36:40 +0200 |
| commit | 8bcbf51cf4f7924600eae39db67ff653b48ad95d (patch) | |
| tree | 6ee9ea655c1c983938d9dde63bb68dcb26342b89 /cli/src/main.rs | |
| parent | 7667695eba44f94c064708f5f4c54f78d685b024 (diff) | |
| download | ka-8bcbf51cf4f7924600eae39db67ff653b48ad95d.tar.zst ka-8bcbf51cf4f7924600eae39db67ff653b48ad95d.zip | |
Extract CLI
Diffstat (limited to 'cli/src/main.rs')
| -rw-r--r-- | cli/src/main.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 0000000..945da3a --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,24 @@ +use std::env; + +use ka::{create_command, shift_command, update_command}; + +fn main() { + let args: Vec<String> = env::args().collect(); + let command = args[1].as_str(); + match command { + "create" => { + create_command().unwrap(); + } + "update" => { + update_command().unwrap(); + } + "shift" => { + let file_path = args[2].as_str(); + + let new_cursor: usize = args[3].as_str().parse().expect("Invalid cursor."); + + shift_command(file_path, new_cursor); + } + _ => println!("Unknown command: {}", command), + } +} |
