mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 06:33:03 +02:00
refactor yaak-cli phase 1 command architecture
This commit is contained in:
19
crates-cli/yaak-cli/src/commands/workspace.rs
Normal file
19
crates-cli/yaak-cli/src/commands/workspace.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use crate::cli::{WorkspaceArgs, WorkspaceCommands};
|
||||
use crate::context::CliContext;
|
||||
|
||||
pub fn run(ctx: &CliContext, args: WorkspaceArgs) {
|
||||
match args.command {
|
||||
WorkspaceCommands::List => list(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
fn list(ctx: &CliContext) {
|
||||
let workspaces = ctx.db().list_workspaces().expect("Failed to list workspaces");
|
||||
if workspaces.is_empty() {
|
||||
println!("No workspaces found");
|
||||
} else {
|
||||
for workspace in workspaces {
|
||||
println!("{} - {}", workspace.id, workspace.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user