aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2021-10-02 19:55:01 +0200
committerMel <einebeere@gmail.com>2021-10-02 19:55:01 +0200
commit55da5ae8cf731c768d6cc580693068e64234a4af (patch)
tree9024bf8c315f1c150a468db6791acbeec2907601 /cli
parentc1eccadf76ca7625d8cff9a52480168aab876e62 (diff)
downloadka-55da5ae8cf731c768d6cc580693068e64234a4af.tar.zst
ka-55da5ae8cf731c768d6cc580693068e64234a4af.zip
Use filesystem abstraction throughout Ka.
Diffstat (limited to 'cli')
-rw-r--r--cli/src/main.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 751871c..be52e60 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -1,6 +1,9 @@
use std::env;
-use ka::actions::{create, shift, update, ActionOptions};
+use ka::{
+ actions::{create, shift, update, ActionOptions},
+ filesystem::FsImpl,
+};
fn main() {
let args: Vec<String> = env::args().collect();
@@ -9,17 +12,19 @@ fn main() {
let options = ActionOptions::from_path("./repo");
//let options = ActionOptions::from_pwd().expect("Could not get current path.");
+ let mut filesystem = FsImpl {};
+
match command {
"create" => {
- create(options).expect("Failed executing Create action.");
+ create(options, &mut filesystem).expect("Failed executing Create action.");
}
"update" => {
- update(options).expect("Failed executing Update action.");
+ update(options, &mut filesystem).expect("Failed executing Update action.");
}
"shift" => {
let new_cursor: usize = args[2].as_str().parse().expect("Invalid cursor.");
- shift(options, new_cursor).expect("Failed executing Shift actions.");
+ shift(options, &mut filesystem, new_cursor).expect("Failed executing Shift actions.");
}
_ => panic!("Unknown command: {}", command),
}