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)]
19pub enum Command {
20 New(commands::new::New),
21 Absorb(commands::absorb::Absorb),
22 Parent(commands::parent::Parent),
23 Children(commands::children::Children),
24 Up(commands::up::Up),
25 Down(commands::down::Down),
26 Top(commands::top::Top),
27 Bottom(commands::bottom::Bottom),
28 List(commands::list::List),
29 Status(commands::status::Status),
30 Adopt(commands::adopt::Adopt),
31 Detach(commands::detach::Detach),
32 Rename(commands::rename::Rename),
33 Split(commands::split::Split),
34 Restack(commands::restack::Restack),
35 Run(commands::run::Run),
36 Continue(commands::restack::Continue),
37 Abort(commands::restack::Abort),
38 Undo(commands::undo::Undo),
39 Provider(commands::provider::Provider),
40 Review(commands::review::Review),
41 View(commands::view::View),
42 Sync(commands::sync::Sync),
43 Merge(commands::merge::Merge),
44 Repair(commands::repair::Repair),
45 Submit(commands::submit::Submit),
46 Config(commands::config::Config),
47 Completions(commands::completions::Completions),
48 Guide(commands::guide::Guide),
49 Setup(commands::setup::Setup),
50 Uninstall(commands::uninstall::Uninstall),
51 Upgrade(commands::upgrade::Upgrade),
52 Cleanup(commands::cleanup::Cleanup),
53 Credits(commands::credits::Credits),
54}
55
56#[derive(Debug, Clone, Copy, Eq, PartialEq)]
57pub enum UpdateRefsMode {
58 Config,
59 Enabled,
60 Disabled,
61}
62
63impl UpdateRefsMode {
64 pub fn from_flags(update_refs: bool, no_update_refs: bool) -> Self {
65 match (update_refs, no_update_refs) {
66 (true, false) => Self::Enabled,
67 (false, true) => Self::Disabled,
68 _ => Self::Config,
69 }
70 }
71}
72
73#[derive(Debug, Clone, Copy, Eq, PartialEq)]
74pub enum PushMode {
75 Config,
76 Enabled,
77 Disabled,
78}
79
80impl PushMode {
81 pub fn from_flags(push: bool, no_push: bool) -> Self {
82 match (push, no_push) {
83 (true, false) => Self::Enabled,
84 (false, true) => Self::Disabled,
85 _ => Self::Config,
86 }
87 }
88}