org_gdocs/cli.rs
1//! Command-line argument definitions for `org-gdocs`.
2//!
3//! The binary operates on an org file path and prints a JSON (or text) result
4//! envelope, consumed by the companion Emacs package. All persistent state lives
5//! in the org file itself; the binary is stateless across runs.
6
7use std::path::PathBuf;
8
9use clap::{Parser, Subcommand};
10pub use tftio_cli_common::MetaCommand;
11
12/// Top-level CLI for `org-gdocs`.
13#[derive(Debug, Parser)]
14#[command(name = "org-gdocs")]
15#[command(about = "Sync org-mode documents to Google Docs and pull reviewer comments back")]
16#[command(long_about = None)]
17#[command(version)]
18pub struct Cli {
19 /// Subcommand to execute.
20 #[command(subcommand)]
21 pub command: Command,
22
23 /// Emit machine-readable JSON instead of human-readable text.
24 #[arg(short = 'j', long, global = true)]
25 pub json: bool,
26}
27
28/// Domain subcommands plus the shared metadata commands.
29#[derive(Debug, Subcommand)]
30pub enum Command {
31 /// Shared metadata commands (version, license, completions, doctor, agent).
32 Meta {
33 /// Shared metadata command to execute.
34 #[command(subcommand)]
35 command: MetaCommand,
36 },
37 /// Authenticate with Google via the OAuth loopback flow and cache a token.
38 Auth,
39 /// Publish a projection of the org file to its linked Google Doc.
40 Push {
41 /// Path to the org file to publish.
42 file: PathBuf,
43 },
44 /// Pull reviewer comments from the linked Google Doc into the org file.
45 Pull {
46 /// Path to the org file to update.
47 file: PathBuf,
48 },
49 /// Archive comments already marked DONE in the org file.
50 Clean {
51 /// Path to the org file to clean.
52 file: PathBuf,
53 },
54 /// Print the browser URL of the org file's linked Google Doc.
55 Open {
56 /// Path to the org file whose linked doc URL to print.
57 file: PathBuf,
58 },
59}