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 Top(commands::top::Top),
22 Bottom(commands::bottom::Bottom),
23 List(commands::list::List),
24 Status(commands::status::Status),
25 Adopt(commands::adopt::Adopt),
26 Detach(commands::detach::Detach),
27 Rename(commands::rename::Rename),
28 Restack(commands::restack::Restack),
29 Continue(commands::restack::Continue),
30 Abort(commands::restack::Abort),
31 Provider(commands::provider::Provider),
32 Review(commands::review::Review),
33 Sync(commands::sync::Sync),
34 Merge(commands::merge::Merge),
35 Repair(commands::repair::Repair),
36 Submit(commands::submit::Submit),
37 Config(commands::config::Config),
38 Completions(commands::completions::Completions),
39 Setup(commands::setup::Setup),
40 Upgrade(commands::upgrade::Upgrade),
41 Cleanup(commands::cleanup::Cleanup),
42}
43
44#[derive(Debug, Clone, Copy, Eq, PartialEq)]
45pub enum UpdateRefsMode {
46 Config,
47 Enabled,
48 Disabled,
49}
50
51impl UpdateRefsMode {
52 pub fn from_flags(update_refs: bool, no_update_refs: bool) -> Self {
53 match (update_refs, no_update_refs) {
54 (true, false) => Self::Enabled,
55 (false, true) => Self::Disabled,
56 _ => Self::Config,
57 }
58 }
59}
60
61#[derive(Debug, Clone, Copy, Eq, PartialEq)]
62pub enum PushMode {
63 Config,
64 Enabled,
65 Disabled,
66}
67
68impl PushMode {
69 pub fn from_flags(push: bool, no_push: bool) -> Self {
70 match (push, no_push) {
71 (true, false) => Self::Enabled,
72 (false, true) => Self::Disabled,
73 _ => Self::Config,
74 }
75 }
76}