1use clap::{Parser, Subcommand};
2
3use crate::commands;
4
5#[derive(Debug, Parser)]
6#[command(name = "git-stk")]
7#[command(version)]
8#[command(about = "Git-native stacked branch workflow helper, with GitHub and GitLab integration")]
9#[command(after_help = "New to stacking? Run `git stk guide` for short interactive tours.")]
10pub struct Cli {
11 #[arg(long, short = 'v', global = true)]
13 pub verbose: bool,
14 #[command(subcommand)]
15 pub command: Command,
16}
17
18#[derive(Debug, Subcommand)]
24pub enum Command {
25 New(commands::new::New),
26 Adopt(commands::adopt::Adopt),
27 Split(commands::split::Split),
28 Rename(commands::rename::Rename),
29 Detach(commands::detach::Detach),
30 Absorb(commands::absorb::Absorb),
31
32 Up(commands::up::Up),
33 Down(commands::down::Down),
34 Top(commands::top::Top),
35 Bottom(commands::bottom::Bottom),
36 Parent(commands::parent::Parent),
37 Children(commands::children::Children),
38 List(commands::list::List),
39 Status(commands::status::Status),
40
41 Restack(commands::restack::Restack),
42 Run(commands::run::Run),
43 Continue(commands::restack::Continue),
44 Abort(commands::restack::Abort),
45 Undo(commands::undo::Undo),
46 Repair(commands::repair::Repair),
47
48 Submit(commands::submit::Submit),
49 Review(commands::review::Review),
50 View(commands::view::View),
51 Sync(commands::sync::Sync),
52 Merge(commands::merge::Merge),
53 Provider(commands::provider::Provider),
54
55 Config(commands::config::Config),
56 Setup(commands::setup::Setup),
57 Completions(commands::completions::Completions),
58 Guide(commands::guide::Guide),
59 Upgrade(commands::upgrade::Upgrade),
60 Uninstall(commands::uninstall::Uninstall),
61 Cleanup(commands::cleanup::Cleanup),
62 Credits(commands::credits::Credits),
63}
64
65#[derive(Debug, Clone, Copy, Eq, PartialEq)]
66pub enum UpdateRefsMode {
67 Config,
68 Enabled,
69 Disabled,
70}
71
72impl UpdateRefsMode {
73 pub fn from_flags(update_refs: bool, no_update_refs: bool) -> Self {
74 match (update_refs, no_update_refs) {
75 (true, false) => Self::Enabled,
76 (false, true) => Self::Disabled,
77 _ => Self::Config,
78 }
79 }
80}
81
82#[derive(Debug, Clone, Copy, Eq, PartialEq)]
83pub enum PushMode {
84 Config,
85 Enabled,
86 Disabled,
87}
88
89impl PushMode {
90 pub fn from_flags(push: bool, no_push: bool) -> Self {
91 match (push, no_push) {
92 (true, false) => Self::Enabled,
93 (false, true) => Self::Disabled,
94 _ => Self::Config,
95 }
96 }
97}