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