quartz_cli/action/
mod.rs

1use crate::action;
2use crate::QuartzResult;
3use crate::{cli::Cmd, Ctx};
4
5pub mod body;
6pub mod config;
7pub mod cookie;
8pub mod env;
9pub mod handle;
10pub mod header;
11pub mod history;
12pub mod init;
13pub mod last;
14pub mod ls;
15pub mod query;
16pub mod send;
17pub mod show;
18pub mod snippet;
19pub mod var;
20
21pub async fn cmd(ctx: &mut Ctx, command: Cmd) -> QuartzResult {
22    match command {
23        Cmd::Init(_) => (), // Init is only run on main, before ctx is resolved
24
25        Cmd::Send(args) => action::send::cmd(ctx, args).await?,
26        Cmd::Create(args) => action::handle::create(ctx, args),
27        Cmd::Use(args) => action::handle::switch(ctx, args),
28        Cmd::Ls(args) => action::ls::cmd(ctx, args),
29        Cmd::Show { command } => action::show::cmd(ctx, command)?,
30        Cmd::Edit => action::handle::edit(ctx)?,
31        Cmd::Cp(args) => action::handle::cp(ctx, args)?,
32        Cmd::Mv(args) => action::handle::mv(ctx, args)?,
33        Cmd::Rm(args) => action::handle::rm(ctx, args)?,
34        Cmd::Query { command } => action::query::cmd(ctx, command)?,
35        Cmd::Header { command } => action::header::cmd(ctx, command)?,
36        Cmd::Body(args) => action::body::cmd(ctx, args)?,
37        Cmd::History(args) => action::history::cmd(ctx, args)?,
38        Cmd::Last { command } => action::last::cmd(ctx, command)?,
39        Cmd::Var { command } => action::var::cmd(ctx, command)?,
40        Cmd::Env { command } => action::env::cmd(ctx, command)?,
41        Cmd::Config { command } => action::config::cmd(ctx, command)?,
42    };
43
44    Ok(())
45}