Add zsh completion for 'docker checkpoint' commands
(cherry picked from commit 4f6e4bfd0259331a840cdf06157389fce24f9457)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -494,6 +494,57 @@ __docker_complete_prune_filters() {
|
| 494 | 494 |
return ret |
| 495 | 495 |
} |
| 496 | 496 |
|
| 497 |
+# BO checkpoint |
|
| 498 |
+ |
|
| 499 |
+__docker_checkpoint_commands() {
|
|
| 500 |
+ local -a _docker_checkpoint_subcommands |
|
| 501 |
+ _docker_checkpoint_subcommands=( |
|
| 502 |
+ "create:Create a checkpoint from a running container" |
|
| 503 |
+ "ls:List checkpoints for a container" |
|
| 504 |
+ "rm:Remove a checkpoint" |
|
| 505 |
+ ) |
|
| 506 |
+ _describe -t docker-checkpoint-commands "docker checkpoint command" _docker_checkpoint_subcommands |
|
| 507 |
+} |
|
| 508 |
+ |
|
| 509 |
+__docker_checkpoint_subcommand() {
|
|
| 510 |
+ local -a _command_args opts_help |
|
| 511 |
+ local expl help="--help" |
|
| 512 |
+ integer ret=1 |
|
| 513 |
+ |
|
| 514 |
+ opts_help=("(: -)--help[Print usage]")
|
|
| 515 |
+ |
|
| 516 |
+ case "$words[1]" in |
|
| 517 |
+ (create) |
|
| 518 |
+ _arguments $(__docker_arguments) \ |
|
| 519 |
+ $opts_help \ |
|
| 520 |
+ "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ |
|
| 521 |
+ "($help)--leave-running[Leave the container running after checkpoint]" \ |
|
| 522 |
+ "($help -)1:container:__docker_complete_running_containers" \ |
|
| 523 |
+ "($help -)2:checkpoint: " && ret=0 |
|
| 524 |
+ ;; |
|
| 525 |
+ (ls|list) |
|
| 526 |
+ _arguments $(__docker_arguments) \ |
|
| 527 |
+ $opts_help \ |
|
| 528 |
+ "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ |
|
| 529 |
+ "($help -)1:container:__docker_complete_containers" && ret=0 |
|
| 530 |
+ ;; |
|
| 531 |
+ (rm|remove) |
|
| 532 |
+ _arguments $(__docker_arguments) \ |
|
| 533 |
+ $opts_help \ |
|
| 534 |
+ "($help)--checkpoint-dir=[Use a custom checkpoint storage directory]:dir:_directories" \ |
|
| 535 |
+ "($help -)1:container:__docker_complete_containers" \ |
|
| 536 |
+ "($help -)2:checkpoint: " && ret=0 |
|
| 537 |
+ ;; |
|
| 538 |
+ (help) |
|
| 539 |
+ _arguments $(__docker_arguments) ":subcommand:__docker_checkpoint_commands" && ret=0 |
|
| 540 |
+ ;; |
|
| 541 |
+ esac |
|
| 542 |
+ |
|
| 543 |
+ return ret |
|
| 544 |
+} |
|
| 545 |
+ |
|
| 546 |
+# EO checkpoint |
|
| 547 |
+ |
|
| 497 | 548 |
# BO container |
| 498 | 549 |
|
| 499 | 550 |
__docker_container_commands() {
|
| ... | ... |
@@ -2383,6 +2434,23 @@ __docker_subcommand() {
|
| 2383 | 2383 |
(build|history|import|load|pull|push|save|tag) |
| 2384 | 2384 |
__docker_image_subcommand && ret=0 |
| 2385 | 2385 |
;; |
| 2386 |
+ (checkpoint) |
|
| 2387 |
+ local curcontext="$curcontext" state |
|
| 2388 |
+ _arguments $(__docker_arguments) \ |
|
| 2389 |
+ $opts_help \ |
|
| 2390 |
+ "($help -): :->command" \ |
|
| 2391 |
+ "($help -)*:: :->option-or-argument" && ret=0 |
|
| 2392 |
+ |
|
| 2393 |
+ case $state in |
|
| 2394 |
+ (command) |
|
| 2395 |
+ __docker_checkpoint_commands && ret=0 |
|
| 2396 |
+ ;; |
|
| 2397 |
+ (option-or-argument) |
|
| 2398 |
+ curcontext=${curcontext%:*:*}:docker-${words[-1]}:
|
|
| 2399 |
+ __docker_checkpoint_subcommand && ret=0 |
|
| 2400 |
+ ;; |
|
| 2401 |
+ esac |
|
| 2402 |
+ ;; |
|
| 2386 | 2403 |
(container) |
| 2387 | 2404 |
local curcontext="$curcontext" state |
| 2388 | 2405 |
_arguments $(__docker_arguments) \ |