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