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 Run(commands::run::Run),
33 Continue(commands::restack::Continue),
34 Abort(commands::restack::Abort),
35 Undo(commands::undo::Undo),
36 Provider(commands::provider::Provider),
37 Review(commands::review::Review),
38 View(commands::view::View),
39 Sync(commands::sync::Sync),
40 Merge(commands::merge::Merge),
41 Repair(commands::repair::Repair),
42 Submit(commands::submit::Submit),
43 Config(commands::config::Config),
44 Completions(commands::completions::Completions),
45 Guide(commands::guide::Guide),
46 Setup(commands::setup::Setup),
47 Upgrade(commands::upgrade::Upgrade),
48 Cleanup(commands::cleanup::Cleanup),
49}
50
51#[derive(Debug, Clone, Copy, Eq, PartialEq)]
52pub enum UpdateRefsMode {
53 Config,
54 Enabled,
55 Disabled,
56}
57
58impl UpdateRefsMode {
59 pub fn from_flags(update_refs: bool, no_update_refs: bool) -> Self {
60 match (update_refs, no_update_refs) {
61 (true, false) => Self::Enabled,
62 (false, true) => Self::Disabled,
63 _ => Self::Config,
64 }
65 }
66}
67
68#[derive(Debug, Clone, Copy, Eq, PartialEq)]
69pub enum PushMode {
70 Config,
71 Enabled,
72 Disabled,
73}
74
75impl PushMode {
76 pub fn from_flags(push: bool, no_push: bool) -> Self {
77 match (push, no_push) {
78 (true, false) => Self::Enabled,
79 (false, true) => Self::Disabled,
80 _ => Self::Config,
81 }
82 }
83}