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")]
9pub struct Cli {
10 #[arg(long, short = 'v', global = true)]
12 pub verbose: bool,
13 #[command(subcommand)]
14 pub command: Command,
15}
16
17#[derive(Debug, Subcommand)]
18pub enum Command {
19 New(commands::new::New),
20 Parent(commands::parent::Parent),
21 Children(commands::children::Children),
22 Up(commands::up::Up),
23 Down(commands::down::Down),
24 Top(commands::top::Top),
25 Bottom(commands::bottom::Bottom),
26 List(commands::list::List),
27 Status(commands::status::Status),
28 Adopt(commands::adopt::Adopt),
29 Detach(commands::detach::Detach),
30 Rename(commands::rename::Rename),
31 Restack(commands::restack::Restack),
32 Continue(commands::restack::Continue),
33 Abort(commands::restack::Abort),
34 Provider(commands::provider::Provider),
35 Review(commands::review::Review),
36 Sync(commands::sync::Sync),
37 Merge(commands::merge::Merge),
38 Repair(commands::repair::Repair),
39 Submit(commands::submit::Submit),
40 Config(commands::config::Config),
41 Completions(commands::completions::Completions),
42 Setup(commands::setup::Setup),
43 Upgrade(commands::upgrade::Upgrade),
44 Cleanup(commands::cleanup::Cleanup),
45}
46
47#[derive(Debug, Clone, Copy, Eq, PartialEq)]
48pub enum UpdateRefsMode {
49 Config,
50 Enabled,
51 Disabled,
52}
53
54impl UpdateRefsMode {
55 pub fn from_flags(update_refs: bool, no_update_refs: bool) -> Self {
56 match (update_refs, no_update_refs) {
57 (true, false) => Self::Enabled,
58 (false, true) => Self::Disabled,
59 _ => Self::Config,
60 }
61 }
62}
63
64#[derive(Debug, Clone, Copy, Eq, PartialEq)]
65pub enum PushMode {
66 Config,
67 Enabled,
68 Disabled,
69}
70
71impl PushMode {
72 pub fn from_flags(push: bool, no_push: bool) -> Self {
73 match (push, no_push) {
74 (true, false) => Self::Enabled,
75 (false, true) => Self::Disabled,
76 _ => Self::Config,
77 }
78 }
79}