Skip to main content

wekan_cli/
cli.rs

1use clap::Parser;
2
3use crate::{commands::RootCommand, output::OutputFormat};
4
5#[derive(Debug, Parser)]
6#[command(
7    name = "wekan",
8    version,
9    about = "Agent-first, human-friendly command-line client for Wekan",
10    arg_required_else_help = true,
11    after_help = "Examples:\n  wekan profile add local http://localhost:3000 --use\n  wekan auth login --username alice\n  wekan --output json board list\n  wekan card get card-id --board board-id --list list-id"
12)]
13pub struct Cli {
14    /// Wekan server base URL. Initializes or verifies the selected profile, or identifies an orphaned credential for local-only logout.
15    #[arg(long, global = true, help_heading = "Global options")]
16    pub server: Option<String>,
17
18    /// Named local server profile. Overrides environment and active selection.
19    #[arg(
20        long = "profile",
21        global = true, help_heading = "Global options",
22        value_parser = crate::config::profiles::parse_profile_name
23    )]
24    pub profile_name: Option<String>,
25
26    /// Output format.
27    #[arg(long, global = true, help_heading = "Global options", value_enum, default_value_t = OutputFormat::Human)]
28    pub output: OutputFormat,
29
30    /// Permit plaintext HTTP for a non-loopback server.
31    #[arg(long, global = true, help_heading = "Global options")]
32    pub allow_insecure_http: bool,
33
34    #[command(subcommand)]
35    pub command: RootCommand,
36}