| use clap::{Parser, Subcommand}; |
| use std::path::PathBuf; |
|
|
| use super::query::CliDirection; |
| use super::ui::OutputFormat; |
|
|
| |
| #[derive(Parser, Debug)] |
| #[command(name = "firm")] |
| #[command(version, about = "Firm CLI: Work management in the terminal.")] |
| pub struct FirmCli { |
| |
| #[arg(short, long, global = true, env = "FIRM_WORKSPACE")] |
| pub workspace: Option<PathBuf>, |
|
|
| |
| #[arg(short, long, global = true, env = "FIRM_CACHED")] |
| pub cached: bool, |
|
|
| |
| #[arg(short, long, global = true, env = "FIRM_VERBOSE")] |
| pub verbose: bool, |
|
|
| |
| #[arg(short, long, global = true, default_value_t = OutputFormat::default(), env = "FIRM_FORMAT")] |
| pub format: OutputFormat, |
|
|
| #[command(subcommand)] |
| pub command: FirmCliCommand, |
| } |
|
|
| |
| #[derive(Subcommand, Debug, PartialEq)] |
| pub enum FirmCliCommand { |
| |
| Init, |
| |
| Build, |
| |
| Get { |
| |
| target_type: String, |
| |
| target_id: String, |
| }, |
| |
| List { |
| |
| target_type: String, |
| }, |
| |
| Related { |
| |
| entity_type: String, |
| |
| entity_id: String, |
| |
| #[arg(short, long)] |
| direction: Option<CliDirection>, |
| }, |
| |
| Add { |
| |
| to_file: Option<PathBuf>, |
| |
| #[arg(long)] |
| r#type: Option<String>, |
| |
| #[arg(long)] |
| id: Option<String>, |
| |
| #[arg(long = "field", num_args = 2, value_names = ["FIELD_NAME", "VALUE"])] |
| fields: Vec<String>, |
| |
| #[arg(long = "list", num_args = 2, value_names = ["FIELD_NAME", "ITEM_TYPE"])] |
| lists: Vec<String>, |
| |
| #[arg(long = "list-value", num_args = 2, value_names = ["FIELD_NAME", "VALUE"])] |
| list_values: Vec<String>, |
| }, |
| |
| Query { |
| |
| query: String, |
| }, |
| |
| Source { |
| |
| target_type: String, |
| |
| target_id: String, |
| }, |
| |
| Check { |
| |
| file: Option<PathBuf>, |
| }, |
| |
| Lsp, |
| |
| Mcp, |
| } |
|
|