Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 72d0299

Browse files
authored
Merge pull request #85 from mnottale/cli-help
cli: improve help messages.
2 parents a2753f9 + fbf293e commit 72d0299

File tree

9 files changed

+37
-14
lines changed

9 files changed

+37
-14
lines changed

cmd/deploy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/docker/cli/cli"
67
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/renderer"
89
"github.com/spf13/cobra"
910
)
1011

1112
// deployCmd represents the deploy command
1213
var deployCmd = &cobra.Command{
13-
Use: "deploy <app-name>",
14+
Use: "deploy [<app-name>]",
1415
Short: "Deploy the specified app on the connected cluster",
16+
Long: `Deploy the application on either swarm or kubernetes.
17+
The app's docker-compose.yml is first rendered as per the render sub-command, and
18+
then deployed similarly to 'docker stack deploy'.`,
19+
Args: cli.RequiresMaxArgs(1),
1520
RunE: func(cmd *cobra.Command, args []string) error {
1621
if deployOrchestrator != "swarm" && deployOrchestrator != "kubernetes" {
1722
return fmt.Errorf("orchestrator must be either 'swarm' or 'kubernetes'")

cmd/helm.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ import (
88
)
99

1010
var helmCmd = &cobra.Command{
11-
Use: "helm <app-name> [-c <compose-files>...] [-e key=value...] [-f settings-file...]",
11+
Use: "helm [<app-name>] [-s key=value...] [-f settings-file...]",
1212
Short: "Render the Compose file for this app as an Helm package",
13-
Args: cli.RequiresMaxArgs(1),
13+
Long: `The helm command creates or updates the directory <app-name>.chart.
14+
- Chart.yaml is created or updated from the app's metadata.
15+
- values.yaml is created or updated with the values from settings which are
16+
actually used by the compose file.
17+
- templates/stack.yaml is created, with a stack template extracted from the app's
18+
docker-compose.yml. If the --render option is used, the docker-compose.yml will
19+
be rendered instead of exported as a template. Note that template export will
20+
not work if you use go templating, only variable substitution is supported.`,
21+
Args: cli.RequiresMaxArgs(1),
1422
RunE: func(cmd *cobra.Command, args []string) error {
1523
d, err := parseSettings(helmEnv)
1624
if err != nil {
@@ -29,6 +37,7 @@ func init() {
2937
rootCmd.AddCommand(helmCmd)
3038
if internal.Experimental == "on" {
3139
helmCmd.Flags().StringArrayVarP(&helmComposeFiles, "compose-files", "c", []string{}, "Override Compose files")
40+
helmCmd.Use += " [-c <compose-files>...]"
3241
}
3342
helmCmd.Flags().StringArrayVarP(&helmSettingsFile, "settings-files", "f", []string{}, "Override settings files")
3443
helmCmd.Flags().StringArrayVarP(&helmEnv, "set", "s", []string{}, "Override environment values")

cmd/image-add.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import (
1212
var imageAddCmd = &cobra.Command{
1313
Use: "image-add <app-name> [services...]",
1414
Short: "Add images for given services (default: all) to the app package",
15-
Args: cobra.MinimumNArgs(1),
15+
Long: `This command renders the app's docker-compose.yml file, looks for the
16+
images it uses, and saves them from the local docker daemon to the images/
17+
subdirectory.`,
18+
Args: cobra.MinimumNArgs(1),
1619
RunE: func(cmd *cobra.Command, args []string) error {
1720
d := make(map[string]string)
1821
for _, v := range imageAddEnv {

cmd/init.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import (
1010
var initCmd = &cobra.Command{
1111
Use: "init <app-name> [-c <compose-file>]",
1212
Short: "Initialize an app package in the current working directory",
13-
Args: cli.ExactArgs(1),
13+
Long: `This command initializes a new app package. If the -c option is used, or
14+
if a file named docker-compose.yml is found in the current directory, this file
15+
and the associated .env file if found will be used as the base for this application.`,
16+
Args: cli.ExactArgs(1),
1417
RunE: func(cmd *cobra.Command, args []string) error {
1518
return packager.Init(args[0], composeFile)
1619
},

cmd/inspect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88

99
// inspectCmd represents the inspect command
1010
var inspectCmd = &cobra.Command{
11-
Use: "inspect <app-name>",
12-
Short: "Retrieve metadata for a given app package",
11+
Use: "inspect [<app-name>]",
12+
Short: "Shows metadata and settings for a given app package",
1313
Args: cli.RequiresMaxArgs(1),
1414
RunE: func(cmd *cobra.Command, args []string) error {
1515
return renderer.Inspect(firstOrEmpty(args))

cmd/pack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
var packCmd = &cobra.Command{
11-
Use: "pack <app-name> [-o output_file]",
11+
Use: "pack [<app-name>] [-o output_file]",
1212
Short: "Pack this app as a single file",
1313
Args: cli.RequiresMaxArgs(1),
1414
RunE: func(cmd *cobra.Command, args []string) error {

cmd/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
var pushCmd = &cobra.Command{
11-
Use: "push <app-name>",
11+
Use: "push [<app-name>]",
1212
Short: "Push the application to a registry",
1313
Args: cli.RequiresMaxArgs(1),
1414
RunE: func(cmd *cobra.Command, args []string) error {

cmd/root.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ import (
1212

1313
// rootCmd represents the base command when called without any subcommands
1414
var rootCmd = &cobra.Command{
15-
Use: "docker-app",
16-
Short: "Docker App Packages",
17-
Long: "",
15+
Use: "docker-app",
16+
Short: "Docker App Packages",
17+
Long: `Create, render deploy and otherwise manipulate an app package.
18+
For most sub-commands that take an app-package as only positional argument, this
19+
argument is optional: an app package is looked for in the current working directory.
20+
All commands accept both compressed and uncompressed app packages.`,
1821
SilenceUsage: true,
1922
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
2023
if internal.Debug {

cmd/save.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
)
99

1010
var saveCmd = &cobra.Command{
11-
Use: "save <app-name>",
12-
Short: "Save the application to docker (in preparation for push)",
11+
Use: "save [<app-name>]",
12+
Short: "Save the application as an image to the docker daemon(in preparation for push)",
1313
Args: cli.RequiresMaxArgs(1),
1414
RunE: func(cmd *cobra.Command, args []string) error {
1515
if saveTag == "" {

0 commit comments

Comments
 (0)