use clap::{Args, Parser, Subcommand};
#[derive(Parser)]
#[command(name = "fr", about = concat!("[>] frame v", env!("CARGO_PKG_VERSION"), " - your backlog is plain text"), version)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
#[arg(long, global = true)]
pub json: bool,
#[arg(short = 'C', long = "project-dir", global = true)]
pub project_dir: Option<String>,
}
#[derive(Subcommand)]
pub enum Commands {
Init(InitArgs),
List(ListArgs),
Show(ShowArgs),
Ready(ReadyArgs),
Blocked,
Search(SearchArgs),
Inbox(InboxCmd),
Tracks,
Stats(StatsArgs),
Recent(RecentArgs),
Deps(DepsArgs),
Check,
Add(AddArgs),
Push(PushArgs),
Sub(SubArgs),
State(StateArgs),
Start(StartArgs),
Done(DoneArgs),
Tag(TagArgs),
Dep(DepArgs),
Note(NoteArgs),
Ref(RefArgs),
Spec(SpecArgs),
Title(TitleArgs),
Mv(MvArgs),
Triage(TriageArgs),
Track(TrackCmd),
Clean(CleanArgs),
Import(ImportArgs),
Delete(DeleteArgs),
Projects(ProjectsCmd),
Recovery(RecoveryCmd),
}
#[derive(Args)]
pub struct InitArgs {
#[arg(long)]
pub name: Option<String>,
#[arg(long, num_args = 2, value_names = ["ID", "NAME"], action = clap::ArgAction::Append)]
pub track: Vec<String>,
#[arg(long)]
pub force: bool,
}
#[derive(Args)]
pub struct ListArgs {
pub track: Option<String>,
#[arg(long)]
pub state: Option<String>,
#[arg(long)]
pub tag: Option<String>,
#[arg(long)]
pub all: bool,
}
#[derive(Args)]
pub struct ShowArgs {
pub id: String,
#[arg(long)]
pub context: bool,
}
#[derive(Args)]
pub struct ReadyArgs {
#[arg(long)]
pub cc: bool,
#[arg(long)]
pub track: Option<String>,
#[arg(long)]
pub tag: Option<String>,
}
#[derive(Args)]
pub struct SearchArgs {
pub pattern: String,
#[arg(long)]
pub track: Option<String>,
#[arg(short, long)]
pub archive: bool,
}
#[derive(Args)]
pub struct InboxCmd {
pub text: Option<String>,
#[arg(long)]
pub tag: Vec<String>,
#[arg(long)]
pub note: Option<String>,
}
#[derive(Args)]
pub struct StatsArgs {
#[arg(long)]
pub all: bool,
}
#[derive(Args)]
pub struct RecentArgs {
#[arg(long, default_value = "20")]
pub limit: usize,
}
#[derive(Args)]
pub struct DepsArgs {
pub id: String,
}
#[derive(Args)]
pub struct AddArgs {
pub track: String,
pub title: String,
#[arg(long)]
pub after: Option<String>,
#[arg(long)]
pub found_from: Option<String>,
}
#[derive(Args)]
pub struct PushArgs {
pub track: String,
pub title: String,
}
#[derive(Args)]
pub struct SubArgs {
pub id: String,
pub title: String,
}
#[derive(Args)]
pub struct StateArgs {
pub id: String,
pub state: String,
}
#[derive(Args)]
pub struct StartArgs {
pub id: String,
}
#[derive(Args)]
pub struct DoneArgs {
pub id: String,
}
#[derive(Args)]
pub struct TagArgs {
pub id: String,
pub action: String,
pub tag: String,
}
#[derive(Args)]
pub struct DepArgs {
pub id: String,
pub action: String,
pub dep_id: String,
}
#[derive(Args)]
pub struct NoteArgs {
pub id: String,
pub text: String,
#[arg(long)]
pub replace: bool,
}
#[derive(Args)]
pub struct RefArgs {
pub id: String,
pub path: String,
}
#[derive(Args)]
pub struct SpecArgs {
pub id: String,
pub path: String,
}
#[derive(Args)]
pub struct TitleArgs {
pub id: String,
pub title: String,
}
#[derive(Args)]
pub struct MvArgs {
pub id: String,
pub position: Option<usize>,
#[arg(long)]
pub top: bool,
#[arg(long)]
pub after: Option<String>,
#[arg(long)]
pub track: Option<String>,
#[arg(long)]
pub promote: bool,
#[arg(long)]
pub parent: Option<String>,
}
#[derive(Args)]
pub struct TriageArgs {
pub index: usize,
#[arg(long)]
pub track: String,
#[arg(long)]
pub top: bool,
#[arg(long)]
pub bottom: bool,
#[arg(long)]
pub after: Option<String>,
}
#[derive(Args)]
pub struct DeleteArgs {
#[arg(required = true)]
pub ids: Vec<String>,
#[arg(long)]
pub yes: bool,
}
#[derive(Args)]
pub struct TrackCmd {
#[command(subcommand)]
pub action: TrackAction,
}
#[derive(Subcommand)]
pub enum TrackAction {
New(TrackNewArgs),
Shelve(TrackIdArg),
Activate(TrackIdArg),
Archive(TrackIdArg),
Delete(TrackIdArg),
Mv(TrackMvArgs),
CcFocus(CcFocusArgs),
Rename(TrackRenameArgs),
}
#[derive(Args)]
pub struct TrackNewArgs {
pub id: String,
pub name: String,
}
#[derive(Args)]
pub struct TrackIdArg {
pub id: String,
}
#[derive(Args)]
pub struct CcFocusArgs {
pub id: Option<String>,
#[arg(long)]
pub clear: bool,
}
#[derive(Args)]
pub struct TrackMvArgs {
pub id: String,
pub position: usize,
}
#[derive(Args)]
pub struct TrackRenameArgs {
pub id: String,
#[arg(long)]
pub name: Option<String>,
#[arg(long, value_name = "NEW_ID")]
pub new_id: Option<String>,
#[arg(long)]
pub prefix: Option<String>,
#[arg(long)]
pub dry_run: bool,
#[arg(long, short)]
pub yes: bool,
}
#[derive(Args)]
pub struct CleanArgs {
#[arg(long)]
pub dry_run: bool,
}
#[derive(Args)]
pub struct ImportArgs {
pub file: String,
#[arg(long)]
pub track: String,
#[arg(long)]
pub top: bool,
#[arg(long)]
pub after: Option<String>,
}
#[derive(Args)]
pub struct ProjectsCmd {
#[command(subcommand)]
pub action: Option<ProjectsAction>,
}
#[derive(Subcommand)]
pub enum ProjectsAction {
List,
Add(ProjectsAddArgs),
Remove(ProjectsRemoveArgs),
}
#[derive(Args)]
pub struct ProjectsAddArgs {
pub path: String,
}
#[derive(Args)]
pub struct ProjectsRemoveArgs {
pub name_or_path: String,
}
#[derive(Args)]
pub struct RecoveryCmd {
#[command(subcommand)]
pub action: Option<RecoveryAction>,
#[arg(long)]
pub limit: Option<usize>,
#[arg(long)]
pub since: Option<String>,
#[arg(long)]
pub json: bool,
}
#[derive(Subcommand)]
pub enum RecoveryAction {
Prune(RecoveryPruneArgs),
Path,
}
#[derive(Args)]
pub struct RecoveryPruneArgs {
#[arg(long)]
pub before: Option<String>,
#[arg(long)]
pub all: bool,
}