about summary refs log tree commit diff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml9
-rw-r--r--cli/src/main.rs24
2 files changed, 33 insertions, 0 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
new file mode 100644
index 0000000..a1d090c
--- /dev/null
+++ b/cli/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "ka-cli"
+version = "0.1.0"
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+ka = { path = "../" }
\ No newline at end of file
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),
+    }
+}