diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-04-02 21:04:52 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-04-02 21:04:52 +0200 |
commit | e5fef4f81679582cd6e55de3c8d4461fe712c997 (patch) | |
tree | d3455653f52261db8ccc0b42841a8d953f5d494b /src/lib.rs | |
parent | 3a0452fb06c116de61ae75cf34931d4747c5953f (diff) |
Start the basics of listing repos
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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()); |