23 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
535ac074d0
completion: add completion for "fluentd-write-timeout"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-16 01:27:49 +02:00
Sebastiaan van Stijn
1d768f8983
update go:build tags to go1.23 to align with vendor.mod
Go maintainers started to unconditionally update the minimum go version
for golang.org/x/ dependencies to go1.23, which means that we'll no longer
be able to support any version below that when updating those dependencies;

> all: upgrade go directive to at least 1.23.0 [generated]
>
> By now Go 1.24.0 has been released, and Go 1.22 is no longer supported
> per the Go Release Policy (https://go.dev/doc/devel/release#policy).
>
> For golang/go#69095.

This updates our minimum version to go1.23, as we won't be able to maintain
compatibility with older versions because of the above.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-17 10:43:47 +02:00
Sebastiaan van Stijn
9f19820f88
cli/command/completion: deprecate ValidArgsFn
Cobra now defines a CompletionFunc for the same, so we can alias
it to that, and stop using our own definition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-21 20:30:58 +01:00
Sebastiaan van Stijn
46caf5697c
remove legacy build-tags
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-03-08 12:47:03 +01:00
Sebastiaan van Stijn
d1d5353269
cli/command/container: fix missing go:build tag
make shell
    make -C ./internal/gocompat/

    GO111MODULE=on go test -v
    # github.com/docker/cli/cli/command/container
    ../../cli/command/container/completion.go:37:28: implicit function instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../cli/command/container/completion.go:82:25: implicit function instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    ../../cli/command/container/completion.go:92:27: implicit function instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
    FAIL	gocompat [build failed]

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-11-15 11:06:20 +01:00
Harald Albers
4525fe37b4 Add completion for --volume-driver
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
db0ed1e216 Add completion for --cgroupns
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
2915749279 Add completion for --uts
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
3a2503fa43 Add completion for --log-driver and --log-opt
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
9a9ae231a9 Add completion for --security-opt
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
5f7c43e5e6 Add completion for --detach-keys
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
3292afe6e6 Add completion for --userns
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
5d709a8d9f Add completion for --ulimit
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
2d89339b34 Add completion for --storage-opt
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
ac7bde6f64 Add completion for --pid
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:55:59 +00:00
Harald Albers
e513454244 Add completion for --link
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:35:34 +00:00
Harald Albers
c555327f0b Add completion for --ipc
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:35:34 +00:00
Harald Albers
b598ec8cdb Add completion for --attach
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:35:34 +00:00
Harald Albers
761d76750c Share the container completions
Signed-off-by: Harald Albers <github@albersweb.de>
2024-11-08 15:35:34 +00:00
Sebastiaan van Stijn
462e08219d
cli/container: use github.com/moby/sys/capability for completions
We used a hard-coded list of capabilities that we copied from containerd,
but the new "capability" package allows use to have a maintained list
of capabilities.

There's likely still some improvements to be made;

First of all, the capability package could provide a function to get the list
of strings.

On the completion-side, we need to consider what format is most convenient;
currently we use the canonical name (uppercase and "CAP_" prefix), however,
tab-completion is case-sensitive by default, so requires the user to type
uppercase letters to filter the list of options.

Bash completion provides a `completion-ignore-case on` option to make completion
case-insensitive (https://askubuntu.com/a/87066), but it looks to be a global
option; the current cobra.CompletionOptions also don't provide this as an option
to be used in the generated completion-script.

Fish completion has `smartcase` (by default?) which matches any case if
all of the input is lowercase.

Zsh does not have a dedicated option, but allows setting matching-rules
(see https://superuser.com/a/1092328).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-01 14:01:02 +02:00
Sebastiaan van Stijn
b1c0ddca02
cli/command/container: add completion for --stop-signal
With this patch:

    docker run --stop-signal <TAB>
    ABRT  IOT      RTMAX-4   RTMIN     RTMIN+11  TSTP
    ALRM  KILL     RTMAX-5   RTMIN+1   RTMIN+12  TTIN
    BUS   PIPE     RTMAX-6   RTMIN+2   RTMIN+13  TTOU
    CHLD  POLL     RTMAX-7   RTMIN+3   RTMIN+14  URG
    CLD   PROF     RTMAX-8   RTMIN+4   RTMIN+15  USR1
    CONT  PWR      RTMAX-9   RTMIN+5   SEGV      USR2
    FPE   QUIT     RTMAX-10  RTMIN+6   STKFLT    VTALRM
    HUP   RTMAX    RTMAX-11  RTMIN+7   STOP      WINCH
    ILL   RTMAX-1  RTMAX-12  RTMIN+8   SYS       XCPU
    INT   RTMAX-2  RTMAX-13  RTMIN+9   TERM      XFSZ
    IO    RTMAX-3  RTMAX-14  RTMIN+10  TRAP

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-17 01:25:34 +02:00
Sebastiaan van Stijn
7fe7223c2c
cli/command/container: add completion for --restart
With this patch:

    docker run --restart <TAB>
    always  no  on-failure  unless-stopped

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-17 01:25:34 +02:00
Sebastiaan van Stijn
f30158dbf8
cli/command/container: add completion for --cap-add, --cap-drop
With this patch:

    docker run --cap-add <TAB>
    ALL                     CAP_KILL                CAP_SETUID
    CAP_AUDIT_CONTROL       CAP_LEASE               CAP_SYSLOG
    CAP_AUDIT_READ          CAP_LINUX_IMMUTABLE     CAP_SYS_ADMIN
    CAP_AUDIT_WRITE         CAP_MAC_ADMIN           CAP_SYS_BOOT
    CAP_BLOCK_SUSPEND       CAP_MAC_OVERRIDE        CAP_SYS_CHROOT
    CAP_BPF                 CAP_MKNOD               CAP_SYS_MODULE
    CAP_CHECKPOINT_RESTORE  CAP_NET_ADMIN           CAP_SYS_NICE
    CAP_CHOWN               CAP_NET_BIND_SERVICE    CAP_SYS_PACCT
    CAP_DAC_OVERRIDE        CAP_NET_BROADCAST       CAP_SYS_PTRACE
    CAP_DAC_READ_SEARCH     CAP_NET_RAW             CAP_SYS_RAWIO
    CAP_FOWNER              CAP_PERFMON             CAP_SYS_RESOURCE
    CAP_FSETID              CAP_SETFCAP             CAP_SYS_TIME
    CAP_IPC_LOCK            CAP_SETGID              CAP_SYS_TTY_CONFIG
    CAP_IPC_OWNER           CAP_SETPCAP             CAP_WAKE_ALARM

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-17 01:25:33 +02:00