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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
//! The `podup` subcommand enum, split from `mod.rs` to stay within the
//! source line limit as the CLI surface grows.
use std::path::PathBuf;
use clap::Subcommand;
#[cfg(feature = "completions")]
use clap_complete::Shell;
use super::parse::{parse_pull_policy, parse_scale_pair, parse_timeout};
use super::types::{ConfigFormat, EventsFormat, GenerateCommands, OutputFormat, RmiScope};
#[derive(Subcommand)]
pub(crate) enum Commands {
/// Create and start all services.
Up {
/// Run containers in the background.
#[arg(short, long)]
detach: bool,
/// Build images before starting containers.
#[arg(long, conflicts_with = "no_build")]
build: bool,
/// Watch and sync/rebuild/restart per develop.watch rules.
#[arg(short, long)]
watch: bool,
/// Remove containers for services not defined in the compose file.
#[arg(long)]
remove_orphans: bool,
/// Do not recreate containers that are already running.
#[arg(long, conflicts_with = "force_recreate")]
no_recreate: bool,
/// Recreate containers even if their configuration is unchanged.
#[arg(long)]
force_recreate: bool,
/// Do not start linked services (depends_on) of the named services.
#[arg(long)]
no_deps: bool,
/// Seconds to wait for a container to stop when recreating.
#[arg(short = 't', long, allow_hyphen_values = true, value_parser = parse_timeout)]
timeout: Option<i32>,
/// Override the replica count for a service: SERVICE=N (repeatable).
#[arg(long, value_parser = parse_scale_pair)]
scale: Vec<(String, u32)>,
/// Pull policy before starting: always, missing, never, newer, build.
#[arg(long, value_parser = parse_pull_policy)]
pull: Option<String>,
/// Do not build images, even for services with a build section.
#[arg(long)]
no_build: bool,
/// Suppress image-pull progress output.
#[arg(long)]
quiet_pull: bool,
/// Wait until services are running/healthy before returning.
#[arg(long)]
wait: bool,
/// Maximum seconds to wait with --wait before giving up.
#[arg(long, requires = "wait")]
wait_timeout: Option<u64>,
/// Create containers but do not start them.
#[arg(long)]
no_start: bool,
/// Prefix attached log lines with a timestamp (ignored with -d).
#[arg(long)]
timestamps: bool,
/// Recreate anonymous volumes instead of keeping the previous ones.
#[arg(short = 'V', long)]
renew_anon_volumes: bool,
/// Bring up only these services (and their depends_on); default: all.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Stop and remove containers.
Down {
/// Also remove named volumes declared in the compose file.
#[arg(short = 'v', long)]
volumes: bool,
/// Remove containers for services not defined in the compose file.
#[arg(long)]
remove_orphans: bool,
/// Also remove service images: `all` or `local` (build-section services).
#[arg(long, value_enum)]
rmi: Option<RmiScope>,
/// Seconds to wait for containers to stop before killing them.
#[arg(short = 't', long, allow_hyphen_values = true, value_parser = parse_timeout)]
timeout: Option<i32>,
},
/// Start existing stopped containers.
Start {
/// Wait until services are running/healthy before returning.
#[arg(long)]
wait: bool,
/// Maximum seconds to wait with --wait before giving up.
#[arg(long, requires = "wait")]
wait_timeout: Option<u64>,
/// Start only these services.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Stop running containers without removing them.
Stop {
/// Seconds to wait for containers to stop before killing them.
#[arg(short = 't', long, allow_hyphen_values = true, value_parser = parse_timeout)]
timeout: Option<i32>,
/// Stop only these services.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Set the number of running containers for services.
Scale {
/// Target replica counts: SERVICE=N (one or more).
#[arg(value_parser = parse_scale_pair, required = true)]
pairs: Vec<(String, u32)>,
},
/// Create containers for services without starting them.
Create {
/// Build images before creating containers.
#[arg(long)]
build: bool,
/// Recreate containers even if their configuration is unchanged.
#[arg(long)]
force_recreate: bool,
/// Do not recreate containers that already exist.
#[arg(long, conflicts_with = "force_recreate")]
no_recreate: bool,
/// Pull policy before creating: always, missing, never, newer, build.
#[arg(long, value_parser = parse_pull_policy)]
pull: Option<String>,
/// Do not create linked services (depends_on) of the named services.
#[arg(long)]
no_deps: bool,
/// Create only these services.
services: Vec<String>,
},
/// Display a live stream of container resource usage.
Stats {
/// Disable streaming; print a single snapshot and exit.
#[arg(long)]
no_stream: bool,
/// Include non-running containers as zeroed rows.
#[arg(short, long)]
all: bool,
/// Do not truncate long container names in the table.
#[arg(long)]
no_trunc: bool,
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
/// Show only these services.
services: Vec<String>,
},
/// List podup compose projects on the host.
Ls {
/// Show all projects, including stopped ones.
#[arg(short, long)]
all: bool,
/// Only display project names. Mutually exclusive with `--format`.
#[arg(short, long, conflicts_with = "format")]
quiet: bool,
/// Filter projects by predicate: name=<NAME> or status=<running|exited>
/// (repeatable).
#[arg(long)]
filter: Vec<String>,
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
},
/// Push service images to their registry.
Push {
/// Continue pushing the remaining services after a failure.
#[arg(long)]
ignore_push_failures: bool,
/// Verify the registry TLS cert (false for insecure/HTTP; default on).
#[arg(long)]
tls_verify: Option<bool>,
/// Suppress the push progress output.
#[arg(short, long)]
quiet: bool,
/// Push only these services.
services: Vec<String>,
},
/// Build or rebuild service images.
Build {
/// Do not use cache when building the image.
#[arg(long)]
no_cache: bool,
/// Always attempt to pull a newer version of the base image.
#[arg(long)]
pull: bool,
/// Set build-time variables (KEY=VAL); may be repeated.
#[arg(long = "build-arg")]
build_arg: Vec<String>,
/// Set the build progress output style (auto, plain, tty); accepted for
/// docker-compose compatibility.
#[arg(long)]
progress: Option<String>,
/// Push each built image to its registry after a successful build.
#[arg(long)]
push: bool,
/// Suppress the build output.
#[arg(short, long)]
quiet: bool,
/// Build only these services.
services: Vec<String>,
},
/// Remove stopped service containers.
#[command(alias = "remove")]
Rm {
/// Remove even running containers (stop first).
#[arg(short, long)]
force: bool,
/// Also remove anonymous volumes attached to the containers.
#[arg(short = 'v', long)]
volumes: bool,
/// Stop the containers (gracefully) before removing them.
#[arg(short = 's', long)]
stop: bool,
/// Remove only these services.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Send a signal to service containers.
Kill {
/// Signal to send (default: SIGKILL).
#[arg(short, long, default_value = "SIGKILL")]
signal: String,
/// Also remove containers for services not in the compose file.
#[arg(long)]
remove_orphans: bool,
/// Signal only these services.
services: Vec<String>,
},
/// Pause running service containers.
Pause {
/// Pause only these services.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Resume paused service containers.
#[command(alias = "resume")]
Unpause {
/// Unpause only these services.
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Run a one-off command in a new service container.
Run {
/// Service to run the command against.
service: String,
/// Remove the container after it exits (the default).
#[arg(long, overrides_with = "no_rm")]
rm: bool,
/// Keep the one-off container after it exits instead of removing it.
#[arg(long, overrides_with = "rm")]
no_rm: bool,
/// Run container in the background.
#[arg(short, long)]
detach: bool,
/// Set environment variables (KEY=VAL).
#[arg(short, long = "env")]
env_overrides: Vec<String>,
/// Override the container name.
#[arg(long)]
name: Option<String>,
/// Publish the service's declared ports (off by default).
#[arg(short = 'P', long)]
service_ports: bool,
/// Run the command as this user (`name or UID[:GID]`).
#[arg(short, long)]
user: Option<String>,
/// Working directory inside the container.
#[arg(short, long)]
workdir: Option<String>,
/// Override the image entrypoint.
#[arg(long)]
entrypoint: Option<String>,
/// Bind-mount an extra volume (HOST:CONTAINER[:OPTS] or NAME:CONTAINER); repeatable.
#[arg(short = 'v', long = "volume")]
volume: Vec<String>,
/// Publish an extra port (HOST:CONTAINER[/PROTO]); repeatable.
#[arg(short = 'p', long = "publish")]
publish: Vec<String>,
/// Keep the container's STDIN open (sets `stdin_open`). `run` streams the
/// container's output but does not attach a live interactive terminal.
#[arg(short, long)]
interactive: bool,
/// No effect; accepted only for docker-compose compatibility. podup never
/// allocates a pseudo-TTY.
#[arg(short = 'T', long = "no-TTY")]
no_tty: bool,
/// Do not start linked services (depends_on) before running.
#[arg(long)]
no_deps: bool,
/// Add a label to the one-off container (KEY=VAL); may be repeated.
#[arg(short = 'l', long = "label")]
label: Vec<String>,
/// Command (and arguments) to run.
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
cmd: Vec<String>,
},
/// Copy files between a service container and the host (SERVICE:PATH for the
/// container side, e.g. `web:/app/data ./local`).
Cp {
/// Source path. Use SERVICE:PATH for a container path.
src: String,
/// Destination path. Use SERVICE:PATH for a container path.
dst: String,
/// Target this replica index (1-based) of a scaled service.
#[arg(long)]
index: Option<u32>,
/// Follow symlinks in the host source before copying into the container.
#[arg(short = 'L', long)]
follow_link: bool,
/// Archive mode (accepted for compatibility; no effect under rootless Podman).
#[arg(short = 'a', long)]
archive: bool,
},
/// List containers.
Ps {
/// Show all containers, including stopped ones.
#[arg(short, long)]
all: bool,
/// Only display container IDs. Mutually exclusive with `--format`.
#[arg(short, long, conflicts_with = "format")]
quiet: bool,
/// Print the service names, one per line, instead of the container table.
#[arg(long = "services")]
services_only: bool,
/// Filter containers by predicate: status=<running|exited> or
/// name=<NAME> (repeatable).
#[arg(long)]
filter: Vec<String>,
/// Filter by container status (running, exited, ...); repeatable.
#[arg(long)]
status: Vec<String>,
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
/// Show only these services.
services: Vec<String>,
},
/// Display the running processes of service containers.
Top {
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
/// Show only these services. Unlike the other service-list commands, `top`
/// takes a plain positional (not `trailing_var_arg`) so `--format` parses
/// in any position (`top web --format json` as well as `top --format json
/// web`); service names are never hyphen-prefixed, so nothing is lost.
services: Vec<String>,
},
/// Stream Podman events for this project's containers.
Events {
/// Output format: a `TYPE ACTION NAME` summary (table) or one JSON
/// object per line (NDJSON, not a JSON array).
#[arg(long, value_enum, default_value_t = EventsFormat::Table)]
format: EventsFormat,
/// Only stream events at or after this timestamp/relative time.
#[arg(long)]
since: Option<String>,
/// Only stream events up to this timestamp/relative time.
#[arg(long)]
until: Option<String>,
/// Filter events by predicate (KEY=VALUE, e.g. event=start); repeatable.
#[arg(long)]
filter: Vec<String>,
/// Deprecated alias for `--format json`; kept for backward compatibility.
/// Cannot be combined with an explicit `--format`.
#[arg(long, hide = true, conflicts_with = "format")]
json: bool,
},
/// Attach to a service container's output (stdout/stderr).
Attach {
/// Service whose container to attach to.
service: String,
/// Index of the container when the service has multiple replicas (1-based).
#[arg(long)]
index: Option<u32>,
/// Do not attach STDIN (accepted for docker-compose compatibility; podup
/// attaches output only).
#[arg(long)]
no_stdin: bool,
/// Proxy received signals to the process (accepted for compatibility).
#[arg(long)]
sig_proxy: Option<bool>,
/// Override the detach key sequence (accepted for compatibility).
#[arg(long)]
detach_keys: Option<String>,
},
/// Block until service containers stop, printing each exit code.
Wait {
/// Wait on these services (default: all).
services: Vec<String>,
},
/// Commit a service container to a new image.
Commit {
/// Service whose container to commit.
service: String,
/// Target image reference (repo[:tag]).
image: String,
/// Commit message for the new image.
#[arg(short, long)]
message: Option<String>,
/// Author of the new image (e.g. "Name <email>").
#[arg(short, long)]
author: Option<String>,
/// Apply a Dockerfile instruction to the committed image (repeatable).
#[arg(short = 'c', long = "change")]
change: Vec<String>,
/// Replica index (1-based) of a scaled service.
#[arg(long)]
index: Option<u32>,
/// Pause the container during commit for a consistent snapshot
/// (default on; `--pause=false` to snapshot a live container).
#[arg(
short,
long,
default_value_t = true,
action = clap::ArgAction::Set,
num_args = 0..=1,
default_missing_value = "true",
)]
pause: bool,
},
/// Export a service container's filesystem as a tar archive.
Export {
/// Service whose container to export.
service: String,
/// Write to this file instead of stdout.
#[arg(short, long)]
output: Option<PathBuf>,
/// Replica index (1-based) of a scaled service.
#[arg(long)]
index: Option<u32>,
},
/// Print the public port for a port binding of a service container.
Port {
/// Service name.
service: String,
/// Private port, e.g. `80` or `80/tcp` (a `/proto` suffix overrides --protocol).
private_port: String,
/// Protocol (tcp or udp).
#[arg(long, visible_alias = "protocol", default_value = "tcp")]
proto: String,
/// Index of the container when the service has multiple replicas (1-based).
#[arg(long)]
index: Option<u32>,
},
/// List the project's named volumes.
#[command(alias = "volume")]
Volumes {
/// Only display volume names. Mutually exclusive with `--format`.
#[arg(short, long, conflicts_with = "format")]
quiet: bool,
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
/// Show only volumes mounted by these services.
services: Vec<String>,
},
/// List images used by services.
#[command(alias = "image")]
Images {
/// Only display image IDs. Mutually exclusive with `--format`.
#[arg(short, long, conflicts_with = "format")]
quiet: bool,
/// Output format.
#[arg(long, value_enum, default_value_t = OutputFormat::Table)]
format: OutputFormat,
/// Show images for these services only.
services: Vec<String>,
},
/// View output from containers.
#[command(alias = "log")]
Logs {
/// Follow log output.
#[arg(short, long)]
follow: bool,
/// Number of lines to show from the end of the logs (default: all).
#[arg(short = 'n', long)]
tail: Option<String>,
/// Show logs since a timestamp or relative time (e.g. 2024-01-01T00:00:00, 10m).
#[arg(long)]
since: Option<String>,
/// Show logs before a timestamp or relative time.
#[arg(long)]
until: Option<String>,
/// Prefix each line with an RFC3339 timestamp.
#[arg(short = 't', long)]
timestamps: bool,
/// Produce monochrome output (no colour in the service-name prefix).
#[arg(long)]
no_color: bool,
/// Do not print the service-name prefix on each line.
#[arg(long)]
no_log_prefix: bool,
/// Show logs for these services (default: all).
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Execute a command in a running service container.
Exec {
/// Set environment variables (KEY=VAL); may be repeated.
#[arg(short, long = "env")]
env: Vec<String>,
/// Run the command as this user (`name or UID[:GID]`).
#[arg(short, long)]
user: Option<String>,
/// Working directory inside the container.
#[arg(short, long)]
workdir: Option<String>,
/// Give extended privileges to the command.
#[arg(long)]
privileged: bool,
/// Detach: run the command in the background.
#[arg(short, long)]
detach: bool,
/// No effect; accepted only for docker-compose compatibility. podup never
/// allocates a pseudo-TTY.
#[arg(short = 'T', long = "no-TTY")]
no_tty: bool,
/// Index of the container when the service has multiple replicas (1-based).
#[arg(long)]
index: Option<u32>,
/// Service name.
service: String,
/// Command (and arguments) to execute.
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
cmd: Vec<String>,
},
/// Pull images for the named services, or all services if none are given.
Pull {
/// Suppress image-pull progress output.
#[arg(short, long)]
quiet: bool,
/// Continue pulling the remaining services after a failure.
#[arg(long)]
ignore_pull_failures: bool,
/// Also pull images for the named services' depends_on services.
#[arg(long)]
include_deps: bool,
/// Pull policy: always, missing, never, newer, build (overrides per-service pull_policy).
#[arg(long, value_parser = parse_pull_policy)]
policy: Option<String>,
/// Only pull images for these services.
services: Vec<String>,
},
/// Restart services.
Restart {
/// Seconds to wait for containers to stop before killing them.
#[arg(short = 't', long, allow_hyphen_values = true, value_parser = parse_timeout)]
timeout: Option<i32>,
/// Do not restart dependent services (depends_on with a restart condition).
#[arg(long)]
no_deps: bool,
/// Restart only these services (default: all).
#[arg(trailing_var_arg = true)]
services: Vec<String>,
},
/// Print the resolved compose file (substitution/extends/include applied).
#[command(alias = "convert")]
Config {
/// Output format.
#[arg(long, value_enum, default_value_t = ConfigFormat::Yaml)]
format: ConfigFormat,
/// Print only the service names, one per line.
#[arg(long)]
services: bool,
/// Print only the named volumes, one per line.
#[arg(long)]
volumes: bool,
/// Print only the service image references, one per line.
#[arg(long)]
images: bool,
/// Print only the profile names, one per line.
#[arg(long)]
profiles: bool,
/// Print the config hash of all services, or of the given comma-separated
/// services ("*" for all).
#[arg(long)]
hash: Option<String>,
/// Only validate the configuration; print nothing.
#[arg(short, long)]
quiet: bool,
/// Leave ${VAR} placeholders literal instead of interpolating them.
#[arg(long)]
no_interpolate: bool,
/// Accepted for docker-compose compatibility; podup output is already
/// normalized.
#[arg(long)]
no_normalize: bool,
/// Rewrite each service image to its registry digest (repo@sha256:...).
#[arg(long)]
resolve_image_digests: bool,
},
/// Generate declarative artifacts from the compose file.
#[command(
alias = "gen",
subcommand_required = true,
arg_required_else_help = true
)]
Generate {
#[command(subcommand)]
kind: GenerateCommands,
},
/// Print help for podup, or for a specific command.
Help {
/// Command to show help for. Extra tokens, `-h`/`--help`, and a leading
/// `--` are tolerated; only the first command name is used.
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
commands: Vec<String>,
},
/// Watch for file changes and sync/rebuild/restart as configured by develop.watch.
Watch,
/// Update podup to the latest signed release (Ed25519 signature + SHA-256
/// verified against the embedded key; fails closed, leaving the binary
/// untouched on any mismatch).
#[cfg(feature = "update")]
Update {
/// Report whether a newer release exists without installing it.
#[arg(long)]
check: bool,
/// Reinstall even if the latest release is not newer than this build.
#[arg(long)]
force: bool,
},
/// Print a shell completion script to stdout for the named shell.
#[cfg(feature = "completions")]
Completions {
/// Shell to generate completions for (bash, zsh, fish, powershell, elvish).
shell: Shell,
},
}