Skip to content

Commit

Permalink
Merge pull request #2678 from carapace-sh/docker-compose-v2.32.3
Browse files Browse the repository at this point in the history
docker-compose: updates from v2.32.3
  • Loading branch information
rsteube authored Jan 16, 2025
2 parents 0507059 + fbaa44b commit 50b9483
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 109 deletions.
31 changes: 31 additions & 0 deletions completers/docker-compose_completer/cmd/alpha_generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
)

var alpha_generateCmd = &cobra.Command{
Use: "generate [OPTIONS] [CONTAINERS...]",
Short: "EXPERIMENTAL - Generate a Compose file from existing containers",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(alpha_generateCmd).Standalone()

alpha_generateCmd.Flags().String("format", "", "Format the output. Values: [yaml | json]")
alpha_generateCmd.Flags().String("name", "", "Project name to set in the Compose file")
alpha_generateCmd.Flags().String("project-dir", "", "Directory to use for the project")
alphaCmd.AddCommand(alpha_generateCmd)

carapace.Gen(alpha_generateCmd).FlagCompletion(carapace.ActionMap{
"format": carapace.ActionValues("yaml", "json"),
"project-dir": carapace.ActionDirectories(),
})

carapace.Gen(alpha_generateCmd).PositionalAnyCompletion(
docker.ActionContainers().FilterArgs(),
)
}
4 changes: 2 additions & 2 deletions completers/docker-compose_completer/cmd/alpha_publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var alpha_publishCmd = &cobra.Command{
Use: "publish [OPTIONS] [REPOSITORY]",
Use: "publish [OPTIONS] REPOSITORY[:TAG]",
Short: "Publish compose application",
Run: func(cmd *cobra.Command, args []string) {},
}
Expand All @@ -15,6 +15,6 @@ func init() {
carapace.Gen(alpha_publishCmd).Standalone()

alpha_publishCmd.Flags().String("oci-version", "", "OCI Image/Artifact specification version (automatically determined by default)")
alpha_publishCmd.Flags().Bool("resolve-image-digests", false, "Pin image tags to digests.")
alpha_publishCmd.Flags().Bool("resolve-image-digests", false, "Pin image tags to digests")
alphaCmd.AddCommand(alpha_publishCmd)
}
20 changes: 0 additions & 20 deletions completers/docker-compose_completer/cmd/alpha_watch.go

This file was deleted.

2 changes: 1 addition & 1 deletion completers/docker-compose_completer/cmd/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

var attachCmd = &cobra.Command{
Use: "attach [OPTIONS] SERVICE",
Short: "Attach local standard input, output, and error streams to a service's running container.",
Short: "Attach local standard input, output, and error streams to a service's running container",
Run: func(cmd *cobra.Command, args []string) {},
}

Expand Down
14 changes: 7 additions & 7 deletions completers/docker-compose_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ var buildCmd = &cobra.Command{
func init() {
carapace.Gen(buildCmd).Standalone()

buildCmd.Flags().StringSlice("build-arg", []string{}, "Set build-time variables for services.")
buildCmd.Flags().String("builder", "", "Set builder to use.")
buildCmd.Flags().StringSlice("build-arg", []string{}, "Set build-time variables for services")
buildCmd.Flags().String("builder", "", "Set builder to use")
buildCmd.Flags().Bool("compress", false, "Compress the build context using gzip. DEPRECATED")
buildCmd.Flags().Bool("force-rm", false, "Always remove intermediate containers. DEPRECATED")
buildCmd.Flags().StringP("memory", "m", "", "Set memory limit for the build container. Not supported by BuildKit.")
buildCmd.Flags().Bool("no-cache", false, "Do not use cache when building the image")
buildCmd.Flags().Bool("no-rm", false, "Do not remove intermediate containers after a successful build. DEPRECATED")
buildCmd.Flags().Bool("parallel", false, "Build images in parallel. DEPRECATED")
buildCmd.Flags().String("progress", "", "Set type of ui output (auto, tty, plain, quiet)")
buildCmd.Flags().Bool("pull", false, "Always attempt to pull a newer version of the image.")
buildCmd.Flags().Bool("push", false, "Push service images.")
buildCmd.Flags().String("progress", "", "Set type of ui output (auto, tty, plain, json, quiet)")
buildCmd.Flags().Bool("pull", false, "Always attempt to pull a newer version of the image")
buildCmd.Flags().Bool("push", false, "Push service images")
buildCmd.Flags().BoolP("quiet", "q", false, "Don't print anything to STDOUT")
buildCmd.Flags().String("ssh", "", "Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)")
buildCmd.Flags().Bool("with-dependencies", false, "Also build dependencies (transitively).")
buildCmd.Flags().Bool("with-dependencies", false, "Also build dependencies (transitively)")
buildCmd.Flag("compress").Hidden = true
buildCmd.Flag("force-rm").Hidden = true
buildCmd.Flag("no-rm").Hidden = true
Expand All @@ -38,7 +38,7 @@ func init() {

// TODO builder
carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{
"progress": carapace.ActionValues("auto", "tty", "plain", "quiet"),
"progress": carapace.ActionValues("auto", "tty", "plain", "json", "quiet"),
})

carapace.Gen(buildCmd).PositionalAnyCompletion(
Expand Down
28 changes: 28 additions & 0 deletions completers/docker-compose_completer/cmd/commit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
)

var commitCmd = &cobra.Command{
Use: "commit [OPTIONS] SERVICE [REPOSITORY[:TAG]]",
Short: "Create a new image from a service container's changes",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(commitCmd).Standalone()

commitCmd.Flags().StringP("author", "a", "", "Author (e.g., \"John Hannibal Smith <[email protected]>\")")
commitCmd.Flags().StringP("change", "c", "", "Apply Dockerfile instruction to the created image")
commitCmd.Flags().String("index", "", "index of the container if service has multiple replicas.")
commitCmd.Flags().StringP("message", "m", "", "Commit message")
commitCmd.Flags().BoolP("pause", "p", false, "Pause container during commit")
rootCmd.AddCommand(commitCmd)

carapace.Gen(commitCmd).PositionalCompletion(
docker.ActionRepositoryTags(),
)
}
12 changes: 7 additions & 5 deletions completers/docker-compose_completer/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ var configCmd = &cobra.Command{
func init() {
carapace.Gen(configCmd).Standalone()

configCmd.Flags().Bool("environment", false, "Print environment used for interpolation.")
configCmd.Flags().String("format", "", "Format the output. Values: [yaml | json]")
configCmd.Flags().String("hash", "", "Print the service config hash, one per line.")
configCmd.Flags().Bool("images", false, "Print the image names, one per line.")
configCmd.Flags().Bool("no-consistency", false, "Don't check model consistency - warning: may produce invalid Compose output")
configCmd.Flags().Bool("no-interpolate", false, "Don't interpolate environment variables.")
configCmd.Flags().Bool("no-normalize", false, "Don't normalize compose model.")
configCmd.Flags().Bool("no-path-resolution", false, "Don't resolve file paths.")
configCmd.Flags().Bool("no-interpolate", false, "Don't interpolate environment variables")
configCmd.Flags().Bool("no-normalize", false, "Don't normalize compose model")
configCmd.Flags().Bool("no-path-resolution", false, "Don't resolve file paths")
configCmd.Flags().StringP("output", "o", "", "Save to file (default to stdout)")
configCmd.Flags().Bool("profiles", false, "Print the profile names, one per line.")
configCmd.Flags().BoolP("quiet", "q", false, "Only validate the configuration, don't print anything.")
configCmd.Flags().Bool("resolve-image-digests", false, "Pin image tags to digests.")
configCmd.Flags().BoolP("quiet", "q", false, "Only validate the configuration, don't print anything")
configCmd.Flags().Bool("resolve-image-digests", false, "Pin image tags to digests")
configCmd.Flags().Bool("services", false, "Print the service names, one per line.")
configCmd.Flags().Bool("variables", false, "Print model variables and default values.")
configCmd.Flags().Bool("volumes", false, "Print the volume names, one per line.")
rootCmd.AddCommand(configCmd)

Expand Down
5 changes: 2 additions & 3 deletions completers/docker-compose_completer/cmd/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ var cpCmd = &cobra.Command{
func init() {
carapace.Gen(cpCmd).Standalone()

cpCmd.Flags().Bool("all", false, "copy to all the containers of the service.")
cpCmd.Flags().Bool("all", false, "Include containers created by the run command")
cpCmd.Flags().BoolP("archive", "a", false, "Archive mode (copy all uid/gid information)")
cpCmd.Flags().BoolP("follow-link", "L", false, "Always follow symbol link in SRC_PATH")
cpCmd.Flags().String("index", "", "index of the container if service has multiple replicas")
cpCmd.Flag("all").Hidden = true
cpCmd.Flags().String("index", "", "Index of the container if service has multiple replicas")
rootCmd.AddCommand(cpCmd)

// TODO index flag
Expand Down
12 changes: 7 additions & 5 deletions completers/docker-compose_completer/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ import (

var createCmd = &cobra.Command{
Use: "create [OPTIONS] [SERVICE...]",
Short: "Creates containers for a service.",
Short: "Creates containers for a service",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(createCmd).Standalone()

createCmd.Flags().Bool("build", false, "Build images before starting containers.")
createCmd.Flags().Bool("force-recreate", false, "Recreate containers even if their configuration and image haven't changed.")
createCmd.Flags().Bool("no-build", false, "Don't build an image, even if it's policy.")
createCmd.Flags().Bool("build", false, "Build images before starting containers")
createCmd.Flags().Bool("force-recreate", false, "Recreate containers even if their configuration and image haven't changed")
createCmd.Flags().Bool("no-build", false, "Don't build an image, even if it's policy")
createCmd.Flags().Bool("no-recreate", false, "If containers already exist, don't recreate them. Incompatible with --force-recreate.")
createCmd.Flags().String("pull", "", "Pull image before running (\"always\"|\"missing\"|\"never\"|\"build\")")
createCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file.")
createCmd.Flags().Bool("quiet-pull", false, "Pull without printing progress information")
createCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file")
createCmd.Flags().StringSlice("scale", []string{}, "Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.")
createCmd.Flags().BoolP("y", "y", false, "Assume \"yes\" as answer to all prompts and run non-interactively")
rootCmd.AddCommand(createCmd)

carapace.Gen(createCmd).FlagCompletion(carapace.ActionMap{
Expand Down
4 changes: 2 additions & 2 deletions completers/docker-compose_completer/cmd/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ var downCmd = &cobra.Command{
func init() {
carapace.Gen(downCmd).Standalone()

downCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file.")
downCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file")
downCmd.Flags().String("rmi", "", "Remove images used by services. \"local\" remove only images that don't have a custom tag (\"local\"|\"all\")")
downCmd.Flags().StringP("timeout", "t", "", "Specify a shutdown timeout in seconds")
downCmd.Flags().BoolP("volumes", "v", false, "Remove named volumes declared in the \"volumes\" section of the Compose file and anonymous volumes attached to containers.")
downCmd.Flags().BoolP("volumes", "v", false, "Remove named volumes declared in the \"volumes\" section of the Compose file and anonymous volumes attached to containers")
rootCmd.AddCommand(downCmd)

// TODO volumes flag
Expand Down
2 changes: 1 addition & 1 deletion completers/docker-compose_completer/cmd/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

var eventsCmd = &cobra.Command{
Use: "events [OPTIONS] [SERVICE...]",
Short: "Receive real time events from containers.",
Short: "Receive real time events from containers",
Run: func(cmd *cobra.Command, args []string) {},
}

Expand Down
17 changes: 9 additions & 8 deletions completers/docker-compose_completer/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ import (

var execCmd = &cobra.Command{
Use: "exec [OPTIONS] SERVICE COMMAND [ARGS...]",
Short: "Execute a command in a running container.",
Short: "Execute a command in a running container",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(execCmd).Standalone()

execCmd.Flags().BoolP("detach", "d", false, "Detached mode: Run command in the background.")
execCmd.Flags().BoolP("detach", "d", false, "Detached mode: Run command in the background")
execCmd.Flags().StringSliceP("env", "e", []string{}, "Set environment variables")
execCmd.Flags().String("index", "", "index of the container if service has multiple replicas")
execCmd.Flags().BoolP("interactive", "i", false, "Keep STDIN open even if not attached.")
execCmd.Flags().String("index", "", "Index of the container if service has multiple replicas")
execCmd.Flags().BoolP("interactive", "i", false, "Keep STDIN open even if not attached")
execCmd.Flags().BoolP("no-TTY", "T", false, "Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY.")
execCmd.Flags().Bool("privileged", false, "Give extended privileges to the process.")
execCmd.Flags().BoolP("tty", "t", false, "Allocate a pseudo-TTY.")
execCmd.Flags().StringP("user", "u", "", "Run the command as this user.")
execCmd.Flags().StringP("workdir", "w", "", "Path to workdir directory for this command.")
execCmd.Flags().Bool("privileged", false, "Give extended privileges to the process")
execCmd.Flags().BoolP("tty", "t", false, "Allocate a pseudo-TTY")
execCmd.Flags().StringP("user", "u", "", "Run the command as this user")
execCmd.Flags().StringP("workdir", "w", "", "Path to workdir directory for this command")
execCmd.Flag("interactive").Hidden = true
execCmd.Flag("tty").Hidden = true
rootCmd.AddCommand(execCmd)
Expand All @@ -43,6 +43,7 @@ func init() {
}
return carapace.ActionValues()
}),
"workdir": carapace.ActionDirectories(),
})

carapace.Gen(execCmd).PositionalCompletion(
Expand Down
29 changes: 29 additions & 0 deletions completers/docker-compose_completer/cmd/export.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/docker-compose_completer/cmd/action"
"github.com/spf13/cobra"
)

var exportCmd = &cobra.Command{
Use: "export [OPTIONS] SERVICE",
Short: "Export a service container's filesystem as a tar archive",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(exportCmd).Standalone()

exportCmd.Flags().String("index", "", "index of the container if service has multiple replicas.")
exportCmd.Flags().StringP("output", "o", "", "Write to a file, instead of STDOUT")
rootCmd.AddCommand(exportCmd)

carapace.Gen(exportCmd).FlagCompletion(carapace.ActionMap{
"output": carapace.ActionFiles(),
})

carapace.Gen(exportCmd).PositionalCompletion(
action.ActionServices(exportCmd),
)
}
2 changes: 1 addition & 1 deletion completers/docker-compose_completer/cmd/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var imagesCmd = &cobra.Command{
func init() {
carapace.Gen(imagesCmd).Standalone()

imagesCmd.Flags().String("format", "", "Format the output. Values: [table | json].")
imagesCmd.Flags().String("format", "", "Format the output. Values: [table | json]")
imagesCmd.Flags().BoolP("quiet", "q", false, "Only display IDs")
rootCmd.AddCommand(imagesCmd)

Expand Down
6 changes: 3 additions & 3 deletions completers/docker-compose_completer/cmd/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (

var killCmd = &cobra.Command{
Use: "kill [OPTIONS] [SERVICE...]",
Short: "Force stop service containers.",
Short: "Force stop service containers",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(killCmd).Standalone()

killCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file.")
killCmd.Flags().StringP("signal", "s", "", "SIGNAL to send to the container.")
killCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file")
killCmd.Flags().StringP("signal", "s", "", "SIGNAL to send to the container")
rootCmd.AddCommand(killCmd)

carapace.Gen(killCmd).FlagCompletion(carapace.ActionMap{
Expand Down
10 changes: 5 additions & 5 deletions completers/docker-compose_completer/cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ var logsCmd = &cobra.Command{
func init() {
carapace.Gen(logsCmd).Standalone()

logsCmd.Flags().BoolP("follow", "f", false, "Follow log output.")
logsCmd.Flags().BoolP("follow", "f", false, "Follow log output")
logsCmd.Flags().String("index", "", "index of the container if service has multiple replicas")
logsCmd.Flags().Bool("no-color", false, "Produce monochrome output.")
logsCmd.Flags().Bool("no-log-prefix", false, "Don't print prefix in logs.")
logsCmd.Flags().Bool("no-color", false, "Produce monochrome output")
logsCmd.Flags().Bool("no-log-prefix", false, "Don't print prefix in logs")
logsCmd.Flags().String("since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
logsCmd.Flags().StringP("tail", "n", "", "Number of lines to show from the end of the logs for each container.")
logsCmd.Flags().BoolP("timestamps", "t", false, "Show timestamps.")
logsCmd.Flags().StringP("tail", "n", "", "Number of lines to show from the end of the logs for each container")
logsCmd.Flags().BoolP("timestamps", "t", false, "Show timestamps")
logsCmd.Flags().String("until", "", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
rootCmd.AddCommand(logsCmd)

Expand Down
6 changes: 3 additions & 3 deletions completers/docker-compose_completer/cmd/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func init() {
carapace.Gen(lsCmd).Standalone()

lsCmd.Flags().BoolP("all", "a", false, "Show all stopped Compose projects")
lsCmd.Flags().String("filter", "", "Filter output based on conditions provided.")
lsCmd.Flags().String("format", "", "Format the output. Values: [table | json].")
lsCmd.Flags().BoolP("quiet", "q", false, "Only display IDs.")
lsCmd.Flags().String("filter", "", "Filter output based on conditions provided")
lsCmd.Flags().String("format", "", "Format the output. Values: [table | json]")
lsCmd.Flags().BoolP("quiet", "q", false, "Only display IDs")
rootCmd.AddCommand(lsCmd)

carapace.Gen(lsCmd).FlagCompletion(carapace.ActionMap{
Expand Down
4 changes: 2 additions & 2 deletions completers/docker-compose_completer/cmd/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (

var portCmd = &cobra.Command{
Use: "port [OPTIONS] SERVICE PRIVATE_PORT",
Short: "Print the public port for a port binding.",
Short: "Print the public port for a port binding",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(portCmd).Standalone()

portCmd.Flags().String("index", "", "index of the container if service has multiple replicas")
portCmd.Flags().String("index", "", "Index of the container if service has multiple replicas")
portCmd.Flags().String("protocol", "", "tcp or udp")
rootCmd.AddCommand(portCmd)

Expand Down
2 changes: 1 addition & 1 deletion completers/docker-compose_completer/cmd/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func init() {
carapace.Gen(psCmd).Standalone()

psCmd.Flags().BoolP("all", "a", false, "Show all stopped containers (including those created by the run command)")
psCmd.Flags().String("filter", "", "Filter services by a property (supported filters: status).")
psCmd.Flags().String("filter", "", "Filter services by a property (supported filters: status)")
psCmd.Flags().String("format", "", "Format output using a custom template:")
psCmd.Flags().Bool("no-trunc", false, "Don't truncate output")
psCmd.Flags().Bool("orphans", false, "Include orphaned services (not declared by project)")
Expand Down
Loading

0 comments on commit 50b9483

Please sign in to comment.