summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-02 21:04:52 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-02 21:04:52 +0200
commite5fef4f81679582cd6e55de3c8d4461fe712c997 (patch)
treed3455653f52261db8ccc0b42841a8d953f5d494b /src/lib.rs
parent3a0452fb06c116de61ae75cf34931d4747c5953f (diff)
Start the basics of listing repos
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e96614f..4685e53 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,7 @@
pub mod git;
pub mod parser;
+use comfy_table::Table;
use parser::*;
use rustyline::error::ReadlineError;
use std::{io, ops::ControlFlow};
@@ -15,6 +16,16 @@ pub fn run_command(user_input: String) -> Result<ControlFlow<(), ()>, ShackleErr
Ok(ShackleCommand::Exit) => {
return Ok(ControlFlow::Break(()));
}
+ Ok(ShackleCommand::List) => {
+ let mut table = Table::new();
+ table.set_header(vec!["path", "description"]);
+ let listing = git::list()?;
+ for meta in listing {
+ table.add_row(vec![meta.path.display().to_string(), meta.description]);
+ }
+
+ println!("{table}");
+ }
Ok(ShackleCommand::GitInit(GitInitArgs { repo_name, group })) => {
let init_result = git::init(&repo_name, &group)?;
println!("Successfully created \"{}\"", init_result.path.display());