1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use clap::{Args, Parser, Subcommand};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct GcpConfig {
pub project_id: String,
pub service_name: String,
pub region: String,
}
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
pub struct Cli {
name: Option<String>,
#[clap(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Iam(Iam),
Run(Run),
Gh(Gh),
Init(Init),
Compute(Compute),
}
#[derive(Debug, Args)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct Iam {
#[clap(subcommand)]
pub command: Option<IamCommands>,
}
#[derive(Debug, Args)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct Compute {
#[clap(subcommand)]
pub command: Option<ComputeCommands>,
}
#[derive(Debug, Args)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct Init {
#[clap(subcommand)]
pub command: Option<InitCommands>,
}
#[derive(Debug, Args)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct Gh {
#[clap(subcommand)]
pub command: Option<GhCommands>,
}
#[derive(Debug, Args)]
#[clap(args_conflicts_with_subcommands = true)]
pub struct Run {
#[clap(subcommand)]
pub command: Option<RunCommands>,
}
#[derive(Debug, Subcommand)]
pub enum IamCommands {
Setup,
Help
}
#[derive(Debug, Subcommand)]
pub enum ComputeCommands {
CreateNat,
Help
}
#[derive(Debug, Subcommand)]
pub enum InitCommands {
Config,
Help
}
#[derive(Debug, Subcommand)]
pub enum GhCommands {
AddEnv,
Help
}
#[derive(Debug, Subcommand)]
pub enum RunCommands {
Deploy,
Help
}