1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00

feat: Provide completion for docker subcommands (#1085)

This is to provide completion for when user types `docker [Tab]`.
This commit is contained in:
Cattle_Horse 2025-04-18 23:43:19 +08:00 committed by GitHub
parent c639113ade
commit 4d0f184096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,11 @@ def "nu-complete docker compose service status" [] {
[paused restarting removing running dead created exited]
}
def "nu-complete docker subcommands" [] {
# ^docker --help | lines | where $it =~ '^ {2}[A-Za-z]' | parse --regex '^ {2}([^\s*]+)\*?\s+.+$'
^docker --help | lines | where $it =~ '^ {2}[A-Za-z]' | parse --regex '^ {2}(?P<value>[^\s*]+)\*?\s+(?P<description>.+)$'
}
# Log in to a Docker registry
export extern "docker login" [
server?: string #Docker registry URL
@ -603,6 +608,7 @@ export extern "docker compose up" [
# An open-source container management platform.
export extern "docker" [
command?: string@"nu-complete docker subcommands" #Subcommands
--config: string #Location of client config files (default "/root/.docker")
--context(-c): string #Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")
--debug(-D) #Enable debug mode