diff --git a/completers/docker-compose_completer/cmd/alpha_generate.go b/completers/docker-compose_completer/cmd/alpha_generate.go new file mode 100644 index 0000000000..e4bfe21f77 --- /dev/null +++ b/completers/docker-compose_completer/cmd/alpha_generate.go @@ -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(), + ) +} diff --git a/completers/docker-compose_completer/cmd/alpha_publish.go b/completers/docker-compose_completer/cmd/alpha_publish.go index d2b071463d..a1095da5a0 100644 --- a/completers/docker-compose_completer/cmd/alpha_publish.go +++ b/completers/docker-compose_completer/cmd/alpha_publish.go @@ -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) {}, } @@ -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) } diff --git a/completers/docker-compose_completer/cmd/alpha_watch.go b/completers/docker-compose_completer/cmd/alpha_watch.go deleted file mode 100644 index 952d1401d1..0000000000 --- a/completers/docker-compose_completer/cmd/alpha_watch.go +++ /dev/null @@ -1,20 +0,0 @@ -package cmd - -import ( - "github.com/carapace-sh/carapace" - "github.com/spf13/cobra" -) - -var alpha_watchCmd = &cobra.Command{ - Use: "watch [SERVICE...]", - Short: "Watch build context for service and rebuild/refresh containers when files are updated", - Run: func(cmd *cobra.Command, args []string) {}, -} - -func init() { - carapace.Gen(alpha_watchCmd).Standalone() - - alpha_watchCmd.Flags().Bool("no-up", false, "Do not build & start services before watching") - alpha_watchCmd.Flags().Bool("quiet", false, "hide build output") - alphaCmd.AddCommand(alpha_watchCmd) -} diff --git a/completers/docker-compose_completer/cmd/attach.go b/completers/docker-compose_completer/cmd/attach.go index 0facef6823..ddba785731 100644 --- a/completers/docker-compose_completer/cmd/attach.go +++ b/completers/docker-compose_completer/cmd/attach.go @@ -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) {}, } diff --git a/completers/docker-compose_completer/cmd/build.go b/completers/docker-compose_completer/cmd/build.go index 7a0b2741cb..3d9a3b8a5b 100644 --- a/completers/docker-compose_completer/cmd/build.go +++ b/completers/docker-compose_completer/cmd/build.go @@ -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 @@ -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( diff --git a/completers/docker-compose_completer/cmd/commit.go b/completers/docker-compose_completer/cmd/commit.go new file mode 100644 index 0000000000..3161c66e78 --- /dev/null +++ b/completers/docker-compose_completer/cmd/commit.go @@ -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 \")") + 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(), + ) +} diff --git a/completers/docker-compose_completer/cmd/config.go b/completers/docker-compose_completer/cmd/config.go index f47e578cc6..8fa0848880 100644 --- a/completers/docker-compose_completer/cmd/config.go +++ b/completers/docker-compose_completer/cmd/config.go @@ -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) diff --git a/completers/docker-compose_completer/cmd/cp.go b/completers/docker-compose_completer/cmd/cp.go index a7d0b42186..885e1c52c4 100644 --- a/completers/docker-compose_completer/cmd/cp.go +++ b/completers/docker-compose_completer/cmd/cp.go @@ -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 diff --git a/completers/docker-compose_completer/cmd/create.go b/completers/docker-compose_completer/cmd/create.go index fb0d750201..4edd20b726 100644 --- a/completers/docker-compose_completer/cmd/create.go +++ b/completers/docker-compose_completer/cmd/create.go @@ -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{ diff --git a/completers/docker-compose_completer/cmd/down.go b/completers/docker-compose_completer/cmd/down.go index b7a5540c80..2c9ff414c0 100644 --- a/completers/docker-compose_completer/cmd/down.go +++ b/completers/docker-compose_completer/cmd/down.go @@ -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 diff --git a/completers/docker-compose_completer/cmd/events.go b/completers/docker-compose_completer/cmd/events.go index d6899a5308..8a80b6de07 100644 --- a/completers/docker-compose_completer/cmd/events.go +++ b/completers/docker-compose_completer/cmd/events.go @@ -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) {}, } diff --git a/completers/docker-compose_completer/cmd/exec.go b/completers/docker-compose_completer/cmd/exec.go index 1ca632a951..640bb48555 100644 --- a/completers/docker-compose_completer/cmd/exec.go +++ b/completers/docker-compose_completer/cmd/exec.go @@ -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) @@ -43,6 +43,7 @@ func init() { } return carapace.ActionValues() }), + "workdir": carapace.ActionDirectories(), }) carapace.Gen(execCmd).PositionalCompletion( diff --git a/completers/docker-compose_completer/cmd/export.go b/completers/docker-compose_completer/cmd/export.go new file mode 100644 index 0000000000..2d66940a6f --- /dev/null +++ b/completers/docker-compose_completer/cmd/export.go @@ -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), + ) +} diff --git a/completers/docker-compose_completer/cmd/images.go b/completers/docker-compose_completer/cmd/images.go index b187a8c6c4..408c07c13f 100644 --- a/completers/docker-compose_completer/cmd/images.go +++ b/completers/docker-compose_completer/cmd/images.go @@ -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) diff --git a/completers/docker-compose_completer/cmd/kill.go b/completers/docker-compose_completer/cmd/kill.go index 6659847cac..bea8c69225 100644 --- a/completers/docker-compose_completer/cmd/kill.go +++ b/completers/docker-compose_completer/cmd/kill.go @@ -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{ diff --git a/completers/docker-compose_completer/cmd/logs.go b/completers/docker-compose_completer/cmd/logs.go index 3751a4bc8f..940adebb80 100644 --- a/completers/docker-compose_completer/cmd/logs.go +++ b/completers/docker-compose_completer/cmd/logs.go @@ -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) diff --git a/completers/docker-compose_completer/cmd/ls.go b/completers/docker-compose_completer/cmd/ls.go index dbd26b56bb..9ccf4ec060 100644 --- a/completers/docker-compose_completer/cmd/ls.go +++ b/completers/docker-compose_completer/cmd/ls.go @@ -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{ diff --git a/completers/docker-compose_completer/cmd/port.go b/completers/docker-compose_completer/cmd/port.go index c125dfacf6..b190c8232f 100644 --- a/completers/docker-compose_completer/cmd/port.go +++ b/completers/docker-compose_completer/cmd/port.go @@ -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) diff --git a/completers/docker-compose_completer/cmd/ps.go b/completers/docker-compose_completer/cmd/ps.go index d6a6a77fe8..c508f3cd18 100644 --- a/completers/docker-compose_completer/cmd/ps.go +++ b/completers/docker-compose_completer/cmd/ps.go @@ -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)") diff --git a/completers/docker-compose_completer/cmd/pull.go b/completers/docker-compose_completer/cmd/pull.go index 654a8b7d7c..dd6363fce3 100644 --- a/completers/docker-compose_completer/cmd/pull.go +++ b/completers/docker-compose_completer/cmd/pull.go @@ -15,13 +15,13 @@ var pullCmd = &cobra.Command{ func init() { carapace.Gen(pullCmd).Standalone() - pullCmd.Flags().Bool("ignore-buildable", false, "Ignore images that can be built.") - pullCmd.Flags().Bool("ignore-pull-failures", false, "Pull what it can and ignores images with pull failures.") - pullCmd.Flags().Bool("include-deps", false, "Also pull services declared as dependencies.") - pullCmd.Flags().Bool("no-parallel", false, "DEPRECATED disable parallel pulling.") - pullCmd.Flags().Bool("parallel", false, "DEPRECATED pull multiple images in parallel.") - pullCmd.Flags().String("policy", "", "Apply pull policy (\"missing\"|\"always\").") - pullCmd.Flags().BoolP("quiet", "q", false, "Pull without printing progress information.") + pullCmd.Flags().Bool("ignore-buildable", false, "Ignore images that can be built") + pullCmd.Flags().Bool("ignore-pull-failures", false, "Pull what it can and ignores images with pull failures") + pullCmd.Flags().Bool("include-deps", false, "Also pull services declared as dependencies") + pullCmd.Flags().Bool("no-parallel", false, "DEPRECATED disable parallel pulling") + pullCmd.Flags().Bool("parallel", false, "DEPRECATED pull multiple images in parallel") + pullCmd.Flags().String("policy", "", "Apply pull policy (\"missing\"|\"always\")") + pullCmd.Flags().BoolP("quiet", "q", false, "Pull without printing progress information") pullCmd.Flag("no-parallel").Hidden = true pullCmd.Flag("parallel").Hidden = true rootCmd.AddCommand(pullCmd) diff --git a/completers/docker-compose_completer/cmd/restart.go b/completers/docker-compose_completer/cmd/restart.go index f4a5939bfa..dab0981d34 100644 --- a/completers/docker-compose_completer/cmd/restart.go +++ b/completers/docker-compose_completer/cmd/restart.go @@ -15,7 +15,7 @@ var restartCmd = &cobra.Command{ func init() { carapace.Gen(restartCmd).Standalone() - restartCmd.Flags().Bool("no-deps", false, "Don't restart dependent services.") + restartCmd.Flags().Bool("no-deps", false, "Don't restart dependent services") restartCmd.Flags().StringP("timeout", "t", "", "Specify a shutdown timeout in seconds") rootCmd.AddCommand(restartCmd) diff --git a/completers/docker-compose_completer/cmd/root.go b/completers/docker-compose_completer/cmd/root.go index 293064f65b..d3693f477e 100644 --- a/completers/docker-compose_completer/cmd/root.go +++ b/completers/docker-compose_completer/cmd/root.go @@ -22,15 +22,16 @@ func Execute() error { func init() { carapace.Gen(rootCmd).Standalone() + rootCmd.Flags().Bool("all-resources", false, "Include all resources, even those not used by services") rootCmd.Flags().String("ansi", "", "Control when to print ANSI control characters (\"never\"|\"always\"|\"auto\")") rootCmd.Flags().Bool("compatibility", false, "Run compose in backward compatibility mode") rootCmd.PersistentFlags().Bool("dry-run", false, "Execute command in dry run mode") - rootCmd.Flags().StringSlice("env-file", []string{}, "Specify an alternate environment file.") + rootCmd.Flags().StringSlice("env-file", []string{}, "Specify an alternate environment file") rootCmd.Flags().StringSliceP("file", "f", []string{}, "Compose configuration files") rootCmd.Flags().Bool("no-ansi", false, "Do not print ANSI control characters (DEPRECATED)") rootCmd.Flags().String("parallel", "", "Control max parallelism, -1 for unlimited") rootCmd.Flags().StringSlice("profile", []string{}, "Specify a profile to enable") - rootCmd.Flags().String("progress", "", "Set type of progress output (auto, tty, plain, quiet)") + rootCmd.Flags().String("progress", "", "Set type of progress output (auto, tty, plain, json, quiet)") rootCmd.Flags().String("project-directory", "", "Specify an alternate working directory") rootCmd.Flags().StringP("project-name", "p", "", "Project name") rootCmd.Flags().Bool("verbose", false, "Show more output") diff --git a/completers/docker-compose_completer/cmd/run.go b/completers/docker-compose_completer/cmd/run.go index 22e532ca90..f52da1831a 100644 --- a/completers/docker-compose_completer/cmd/run.go +++ b/completers/docker-compose_completer/cmd/run.go @@ -4,38 +4,40 @@ import ( "github.com/carapace-sh/carapace" "github.com/carapace-sh/carapace-bin/completers/docker-compose_completer/cmd/action" "github.com/carapace-sh/carapace-bin/pkg/actions/env" + "github.com/carapace-sh/carapace/pkg/style" "github.com/spf13/cobra" ) var runCmd = &cobra.Command{ Use: "run [OPTIONS] SERVICE [COMMAND] [ARGS...]", - Short: "Run a one-off command on a service.", + Short: "Run a one-off command on a service", Run: func(cmd *cobra.Command, args []string) {}, } func init() { carapace.Gen(runCmd).Standalone() - runCmd.Flags().Bool("build", false, "Build image before starting container.") + runCmd.Flags().Bool("build", false, "Build image before starting container") runCmd.Flags().String("cap-add", "", "Add Linux capabilities") runCmd.Flags().String("cap-drop", "", "Drop Linux capabilities") runCmd.Flags().BoolP("detach", "d", false, "Run container in background and print container ID") runCmd.Flags().String("entrypoint", "", "Override the entrypoint of the image") runCmd.Flags().StringSliceP("env", "e", []string{}, "Set environment variables") - runCmd.Flags().BoolP("interactive", "i", false, "Keep STDIN open even if not attached.") + runCmd.Flags().BoolP("interactive", "i", false, "Keep STDIN open even if not attached") runCmd.Flags().StringSliceP("label", "l", []string{}, "Add or override a label") runCmd.Flags().String("name", "", "Assign a name to the container") - runCmd.Flags().BoolP("no-TTY", "T", false, "Disable pseudo-TTY allocation (default: auto-detected).") - runCmd.Flags().Bool("no-deps", false, "Don't start linked services.") - runCmd.Flags().StringSliceP("publish", "p", []string{}, "Publish a container's port(s) to the host.") - runCmd.Flags().Bool("quiet-pull", false, "Pull without printing progress information.") - runCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file.") + runCmd.Flags().BoolP("no-TTY", "T", false, "Disable pseudo-TTY allocation (default: auto-detected)") + runCmd.Flags().Bool("no-deps", false, "Don't start linked services") + runCmd.Flags().StringSliceP("publish", "p", []string{}, "Publish a container's port(s) to the host") + runCmd.Flags().String("pull", "", "Pull image before running (\"always\"|\"missing\"|\"never\")") + runCmd.Flags().Bool("quiet-pull", false, "Pull without printing progress information") + runCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file") runCmd.Flags().Bool("rm", false, "Automatically remove the container when it exits") - runCmd.Flags().BoolP("service-ports", "P", false, "Run command with all service's ports enabled and mapped to the host.") - runCmd.Flags().BoolP("tty", "t", false, "Allocate a pseudo-TTY.") - runCmd.Flags().Bool("use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to.") + runCmd.Flags().BoolP("service-ports", "P", false, "Run command with all service's ports enabled and mapped to the host") + runCmd.Flags().BoolP("tty", "t", false, "Allocate a pseudo-TTY") + runCmd.Flags().Bool("use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to") runCmd.Flags().StringP("user", "u", "", "Run as specified username or uid") - runCmd.Flags().StringSliceP("volume", "v", []string{}, "Bind mount a volume.") + runCmd.Flags().StringSliceP("volume", "v", []string{}, "Bind mount a volume") runCmd.Flags().StringP("workdir", "w", "", "Working directory inside the container") runCmd.Flag("tty").Hidden = true rootCmd.AddCommand(runCmd) @@ -43,6 +45,7 @@ func init() { // TODO flag completion carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{ "env": env.ActionNameValues(false), + "pull": carapace.ActionValues("always", "missing", "never").StyleF(style.ForKeyword), "volume": action.ActionVolumes(runCmd), }) diff --git a/completers/docker-compose_completer/cmd/scale.go b/completers/docker-compose_completer/cmd/scale.go index 0168863081..552f462ebe 100644 --- a/completers/docker-compose_completer/cmd/scale.go +++ b/completers/docker-compose_completer/cmd/scale.go @@ -15,7 +15,7 @@ var scaleCmd = &cobra.Command{ func init() { carapace.Gen(scaleCmd).Standalone() - scaleCmd.Flags().Bool("no-deps", false, "Don't start linked services.") + scaleCmd.Flags().Bool("no-deps", false, "Don't start linked services") rootCmd.AddCommand(scaleCmd) carapace.Gen(scaleCmd).PositionalAnyCompletion( diff --git a/completers/docker-compose_completer/cmd/up.go b/completers/docker-compose_completer/cmd/up.go index bbab8d4d33..eca5c04a76 100644 --- a/completers/docker-compose_completer/cmd/up.go +++ b/completers/docker-compose_completer/cmd/up.go @@ -17,34 +17,39 @@ func init() { carapace.Gen(upCmd).Standalone() upCmd.Flags().Bool("abort-on-container-exit", false, "Stops all containers if any container was stopped. Incompatible with -d") + upCmd.Flags().Bool("abort-on-container-failure", false, "Stops all containers if any container exited with failure. Incompatible with -d") upCmd.Flags().Bool("always-recreate-deps", false, "Recreate dependent containers. Incompatible with --no-recreate.") upCmd.Flags().StringSlice("attach", []string{}, "Restrict attaching to the specified services. Incompatible with --attach-dependencies.") - upCmd.Flags().Bool("attach-dependencies", false, "Automatically attach to log output of dependent services.") - upCmd.Flags().Bool("build", false, "Build images before starting containers.") + upCmd.Flags().Bool("attach-dependencies", false, "Automatically attach to log output of dependent services") + upCmd.Flags().Bool("build", false, "Build images before starting containers") upCmd.Flags().BoolP("detach", "d", false, "Detached mode: Run containers in the background") upCmd.Flags().String("exit-code-from", "", "Return the exit code of the selected service container. Implies --abort-on-container-exit") - upCmd.Flags().Bool("force-recreate", false, "Recreate containers even if their configuration and image haven't changed.") - upCmd.Flags().StringSlice("no-attach", []string{}, "Do not attach (stream logs) to the specified services.") - upCmd.Flags().Bool("no-build", false, "Don't build an image, even if it's policy.") - upCmd.Flags().Bool("no-color", false, "Produce monochrome output.") - upCmd.Flags().Bool("no-deps", false, "Don't start linked services.") - upCmd.Flags().Bool("no-log-prefix", false, "Don't print prefix in logs.") + upCmd.Flags().Bool("force-recreate", false, "Recreate containers even if their configuration and image haven't changed") + upCmd.Flags().Bool("menu", false, "Enable interactive shortcuts when running attached. Incompatible with --detach. Can also be enable/disable by setting COMPOSE_MENU environment var.") + upCmd.Flags().StringSlice("no-attach", []string{}, "Do not attach (stream logs) to the specified services") + upCmd.Flags().Bool("no-build", false, "Don't build an image, even if it's policy") + upCmd.Flags().Bool("no-color", false, "Produce monochrome output") + upCmd.Flags().Bool("no-deps", false, "Don't start linked services") + upCmd.Flags().Bool("no-log-prefix", false, "Don't print prefix in logs") upCmd.Flags().Bool("no-recreate", false, "If containers already exist, don't recreate them. Incompatible with --force-recreate.") - upCmd.Flags().Bool("no-start", false, "Don't start the services after creating them.") + upCmd.Flags().Bool("no-start", false, "Don't start the services after creating them") upCmd.Flags().String("pull", "", "Pull image before running (\"always\"|\"missing\"|\"never\")") - upCmd.Flags().Bool("quiet-pull", false, "Pull without printing progress information.") - upCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file.") - upCmd.Flags().BoolP("renew-anon-volumes", "V", false, "Recreate anonymous volumes instead of retrieving data from the previous containers.") + upCmd.Flags().Bool("quiet-pull", false, "Pull without printing progress information") + upCmd.Flags().Bool("remove-orphans", false, "Remove containers for services not defined in the Compose file") + upCmd.Flags().BoolP("renew-anon-volumes", "V", false, "Recreate anonymous volumes instead of retrieving data from the previous containers") upCmd.Flags().StringSlice("scale", []string{}, "Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.") - upCmd.Flags().StringP("timeout", "t", "", "Use this timeout in seconds for container shutdown when attached or when containers are already running.") - upCmd.Flags().Bool("timestamps", false, "Show timestamps.") + upCmd.Flags().StringP("timeout", "t", "", "Use this timeout in seconds for container shutdown when attached or when containers are already running") + upCmd.Flags().Bool("timestamps", false, "Show timestamps") upCmd.Flags().Bool("wait", false, "Wait for services to be running|healthy. Implies detached mode.") - upCmd.Flags().String("wait-timeout", "", "Maximum duration to wait for the project to be running|healthy.") + upCmd.Flags().String("wait-timeout", "", "Maximum duration in seconds to wait for the project to be running|healthy") + upCmd.Flags().BoolP("watch", "w", false, "Watch source code and rebuild/refresh containers when files are updated.") + upCmd.Flags().BoolP("y", "y", false, "Assume \"yes\" as answer to all prompts and run non-interactively") rootCmd.AddCommand(upCmd) carapace.Gen(upCmd).FlagCompletion(carapace.ActionMap{ "attach": action.ActionServices(upCmd), "exit-code-from": action.ActionServices(upCmd), + "no-attach": action.ActionServices(upCmd).UniqueList(","), "pull": carapace.ActionValues("always", "missing", "never").StyleF(style.ForKeyword), "scale": carapace.ActionMultiParts("=", func(c carapace.Context) carapace.Action { switch len(c.Parts) { diff --git a/completers/docker-compose_completer/cmd/version.go b/completers/docker-compose_completer/cmd/version.go index 8e455ac7bb..7343cedc91 100644 --- a/completers/docker-compose_completer/cmd/version.go +++ b/completers/docker-compose_completer/cmd/version.go @@ -15,7 +15,7 @@ func init() { carapace.Gen(versionCmd).Standalone() versionCmd.Flags().StringP("format", "f", "", "Format the output. Values: [pretty | json]. (Default: pretty)") - versionCmd.Flags().Bool("short", false, "Shows only Compose's version number.") + versionCmd.Flags().Bool("short", false, "Shows only Compose's version number") rootCmd.AddCommand(versionCmd) carapace.Gen(versionCmd).FlagCompletion(carapace.ActionMap{ diff --git a/completers/docker-compose_completer/cmd/wait.go b/completers/docker-compose_completer/cmd/wait.go index 2920434857..8c48f35406 100644 --- a/completers/docker-compose_completer/cmd/wait.go +++ b/completers/docker-compose_completer/cmd/wait.go @@ -8,7 +8,7 @@ import ( var waitCmd = &cobra.Command{ Use: "wait SERVICE [SERVICE...] [OPTIONS]", - Short: "Block until the first service container stops", + Short: "Block until containers of all (or specified) services stop.", Run: func(cmd *cobra.Command, args []string) {}, } diff --git a/completers/docker-compose_completer/cmd/watch.go b/completers/docker-compose_completer/cmd/watch.go index 7dd3bfaf5b..2384f66d44 100644 --- a/completers/docker-compose_completer/cmd/watch.go +++ b/completers/docker-compose_completer/cmd/watch.go @@ -16,6 +16,7 @@ func init() { carapace.Gen(watchCmd).Standalone() watchCmd.Flags().Bool("no-up", false, "Do not build & start services before watching") + watchCmd.Flags().Bool("prune", false, "Prune dangling images on rebuild") watchCmd.Flags().Bool("quiet", false, "hide build output") rootCmd.AddCommand(watchCmd)