use clap::{Args, Parser, Subcommand}; #[derive(Debug, Parser)] #[command( name = "outline", version, about = "Search and read Outline documents from the terminal" )] pub struct Cli { /// Outline instance to talk to (default: ) #[arg(long, global = true, value_name = "URL", env = "OUTLINE_URL")] pub base_url: Option, /// API key. Prefer `outline login`: arguments are visible in the process list. #[arg( long, global = true, value_name = "KEY", env = "OUTLINE_API_KEY", hide_env_values = true )] pub api_key: Option, #[command(subcommand)] pub command: Command, } #[derive(Debug, Subcommand)] pub enum Command { /// Store an API key for the configured Outline instance in the system keyring Login, /// Full-text search documents Search(SearchArgs), /// Fetch a document, render it to HTML and open it in the browser Get(GetArgs), } #[derive(Debug, Args)] pub struct SearchArgs { /// The search query pub query: String, /// Maximum number of results to show #[arg(short = 'n', long, default_value_t = 10)] pub limit: u32, } #[derive(Debug, Args)] pub struct GetArgs { /// Document id, urlId, or a full Outline document URL pub reference: String, }