use clap::{Args, Subcommand};
use std::path::PathBuf;
#[derive(Debug, Args)]
pub struct WorkspaceArgs {
#[command(subcommand)]
pub command: WorkspaceSub,
}
#[derive(Debug, Subcommand)]
pub enum WorkspaceSub {
Scratch(ScratchArgs),
Candidate(CandidateArgs),
Promote(PromoteArgs),
Finalize(FinalizeArgs),
Bundle(BundleArgs),
Unbundle(UnbundleArgs),
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLE:\n zenith workspace bundle poster.zen --out poster.zenithbundle")]
pub struct BundleArgs {
pub doc: PathBuf,
#[arg(long)]
pub out: PathBuf,
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLE:\n zenith workspace unbundle poster.zenithbundle")]
pub struct UnbundleArgs {
pub bundle: PathBuf,
}
#[derive(Debug, Args)]
pub struct ScratchArgs {
#[command(subcommand)]
pub command: ScratchSub,
}
#[derive(Debug, Subcommand)]
pub enum ScratchSub {
New(ScratchNewArgs),
List(ScratchListArgs),
Show(ScratchShowArgs),
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLE:\n \
zenith workspace scratch new poster.zen --page main --status draft --notes \"first pass\"")]
pub struct ScratchNewArgs {
pub doc: PathBuf,
#[arg(long, value_name = "ID")]
pub page: Option<String>,
#[arg(long, default_value = "draft", value_name = "STATUS")]
pub status: String,
#[arg(long, value_name = "TEXT")]
pub notes: Option<String>,
#[arg(long, value_name = "TARGET")]
pub promotion_target: Option<String>,
#[arg(long, value_name = "POLICY")]
pub cleanup_policy: Option<String>,
#[arg(long, value_name = "ROLE")]
pub workspace_role: Option<String>,
}
#[derive(Debug, Args)]
pub struct ScratchListArgs {
pub doc: PathBuf,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
pub struct ScratchShowArgs {
pub doc: PathBuf,
pub candidate: String,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLE:\n \
zenith workspace promote poster.zen cand0 --into page.export\n \
zenith workspace promote poster.zen cand0 --into page.export --id-suffix .v2")]
pub struct PromoteArgs {
pub doc: PathBuf,
pub candidate: String,
#[arg(long, value_name = "PAGE_ID")]
pub into: String,
#[arg(long, default_value = ".promoted", value_name = "SUFFIX")]
pub id_suffix: String,
}
#[derive(Debug, Args)]
#[command(
after_help = "EXAMPLE:\n zenith workspace finalize poster.zen\n zenith workspace finalize poster.zen --json"
)]
pub struct FinalizeArgs {
pub doc: PathBuf,
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
#[command(after_help = "EXAMPLE:\n zenith workspace candidate poster.zen cand0 selected")]
pub struct CandidateArgs {
pub doc: PathBuf,
pub candidate: String,
pub status: String,
}