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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
// SPDX-License-Identifier: MIT
//! App platform subcommands and creation arguments.
use clap::Subcommand;
use clap_complete::engine::ArgValueCompleter;
use super::completers::complete_app;
/// Cloud apps subcommands.
#[derive(Subcommand, Debug)]
pub enum AppsCommands {
/// List all cloud apps.
List,
/// Show detailed info for a single app.
Info {
/// App name or numeric ID.
#[arg(
value_name = "APP",
required_unless_present = "id",
add = ArgValueCompleter::new(complete_app)
)]
app: Option<String>,
/// App ID (legacy alias of the positional selector).
#[arg(long, conflicts_with = "app")]
id: Option<String>
},
/// Delete an app.
Delete {
/// App name or numeric ID.
#[arg(
value_name = "APP",
required_unless_present = "id",
add = ArgValueCompleter::new(complete_app)
)]
app: Option<String>,
/// App ID (legacy alias of the positional selector).
#[arg(long, conflicts_with = "app")]
id: Option<String>
},
/// List available app presets (tariffs).
ListPresets,
/// List configured VCS providers.
ListVcsProviders,
/// List repositories of a VCS provider.
ListRepositories {
/// VCS provider ID.
#[arg(long)]
provider_id: String
},
/// Create a new app from a connected VCS repository.
Create(Box<AppCreateArgs>),
/// Show runtime logs of an app.
Logs {
/// App name or numeric ID.
#[arg(
value_name = "APP",
required_unless_present = "id",
add = ArgValueCompleter::new(complete_app)
)]
app: Option<String>,
/// App ID (legacy alias of the positional selector).
#[arg(long, conflicts_with = "app")]
id: Option<String>,
/// Show only the last N lines (applied after date filters).
#[arg(long)]
tail: Option<usize>,
/// Show only lines logged at or after this moment; accepts
/// `YYYY-MM-DD` (local midnight) or an RFC 3339 timestamp.
#[arg(long, conflicts_with = "today")]
since: Option<String>,
/// Show only lines logged today (local time).
#[arg(long)]
today: bool
},
/// List deploys of an app, newest first.
ListDeploys {
/// App name or numeric ID.
#[arg(
value_name = "APP",
required_unless_present = "id",
add = ArgValueCompleter::new(complete_app)
)]
app: Option<String>,
/// App ID (legacy alias of the positional selector).
#[arg(long, conflicts_with = "app")]
id: Option<String>
},
/// Show build/deploy logs of a deploy (the latest one by default).
DeployLogs {
/// App name or numeric ID.
#[arg(
value_name = "APP",
required_unless_present = "id",
add = ArgValueCompleter::new(complete_app)
)]
app: Option<String>,
/// App ID (legacy alias of the positional selector).
#[arg(long, conflicts_with = "app")]
id: Option<String>,
/// Deploy ID (UUID); defaults to the most recent deploy.
#[arg(long)]
deploy_id: Option<String>,
/// Include debug output.
#[arg(long)]
debug: bool
}
}
/// Arguments for `apps create` (boxed in the enum to keep variant sizes even).
#[derive(clap::Args, Debug)]
pub struct AppCreateArgs {
/// App name.
#[arg(long)]
pub name: String,
/// Optional comment.
#[arg(long)]
pub comment: Option<String>,
/// VCS provider ID (UUID).
#[arg(long)]
pub provider_id: String,
/// Repository ID (UUID).
#[arg(long)]
pub repository_id: String,
/// Preset (tariff) ID.
#[arg(long)]
pub preset_id: i64,
/// App type: backend or frontend.
#[arg(long = "type")]
pub app_type: String,
/// Framework (e.g. docker, react, next.js, django).
#[arg(long)]
pub framework: String,
/// Repository branch to build from.
#[arg(long, default_value = "main")]
pub branch: String,
/// Specific commit SHA (defaults to latest on the branch).
#[arg(long)]
pub commit_sha: Option<String>,
/// Build command.
#[arg(long)]
pub build_cmd: Option<String>,
/// Run command (required for backend apps).
#[arg(long)]
pub run_cmd: Option<String>,
/// Index directory starting with '/' (required for frontend apps).
#[arg(long)]
pub index_dir: Option<String>,
/// Enable automatic deploy on push.
#[arg(long)]
pub auto_deploy: bool,
/// Optional project ID to place the app in.
#[arg(long)]
pub project_id: Option<i64>
}