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

Commit 543a5a2

Browse files
authored
Merge pull request #509 from chris-crone/ux-cleanup
Clean up command help and flags
2 parents b5935a5 + b055624 commit 543a5a2

22 files changed

+118
-104
lines changed

cmd/cnab-run/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func getCnabAction() (cnabAction, string, error) {
3838
func main() {
3939
action, actionName, err := getCnabAction()
4040
if err != nil {
41-
fmt.Fprintf(os.Stderr, "Error while parsing cnab operation: %s", err)
41+
fmt.Fprintf(os.Stderr, "Error while parsing CNAB operation: %s", err)
4242
os.Exit(1)
4343
}
4444
instanceName := os.Getenv("CNAB_INSTALLATION_NAME")

e2e/commands_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func testRenderApp(appPath string, env ...string) func(*testing.T) {
6060
data, err := ioutil.ReadFile(filepath.Join(appPath, "env.yml"))
6161
assert.NilError(t, err)
6262
assert.NilError(t, yaml.Unmarshal(data, &envParameters))
63-
args := dockerCli.Command("app", "render", filepath.Join(appPath, "my.dockerapp"), "--parameters-files", filepath.Join(appPath, "parameters-0.yml"))
63+
args := dockerCli.Command("app", "render", filepath.Join(appPath, "my.dockerapp"), "--parameters-file", filepath.Join(appPath, "parameters-0.yml"))
6464
for k, v := range envParameters {
6565
args = append(args, "--set", fmt.Sprintf("%s=%s", k, v))
6666
}

e2e/plugin_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestInvokePluginFromCLI(t *testing.T) {
1515
// docker --help should list app as a top command
1616
cmd.Command = dockerCli.Command("--help")
1717
icmd.RunCmd(cmd).Assert(t, icmd.Expected{
18-
Out: "app* Docker Application Packages (Docker Inc.,",
18+
Out: "app* Docker Application (Docker Inc.,",
1919
})
2020

2121
// docker app --help prints docker-app help
@@ -30,7 +30,7 @@ func TestInvokePluginFromCLI(t *testing.T) {
3030

3131
// docker info should print app version and short description
3232
cmd.Command = dockerCli.Command("info")
33-
re := regexp.MustCompile(`app: Docker Application Packages \(Docker Inc\., .*\)`)
33+
re := regexp.MustCompile(`app: Docker Application \(Docker Inc\., .*\)`)
3434
output := icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined()
3535
assert.Assert(t, re.MatchString(output))
3636
}

e2e/testdata/plugin-usage-experimental.golden

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11

22
Usage: docker app COMMAND
33

4-
Build and deploy Docker Application Packages.
4+
A tool to build and manage Docker Applications.
55

66
Commands:
7-
bundle Create a CNAB invocation image and bundle.json for the application
7+
bundle Create a CNAB invocation image and `bundle.json` for the application
88
completion Generates completion scripts for the specified shell (bash or zsh)
9-
init Start building a Docker application
10-
inspect Shows metadata, parameters and a summary of the compose file for a given application
9+
init Initialize Docker Application definition
10+
inspect Shows metadata, parameters and a summary of the Compose file for a given application
1111
install Install an application
12-
merge Merge a multi-file application into a single file
13-
pull Pull an application from a registry
14-
push Push the application to a registry
15-
render Render the Compose file for the application
16-
split Split a single-file application into multiple files
17-
status Get the installation status. If the installation is a docker application, the status shows the stack services.
12+
merge Merge a directory format Docker Application definition into a single file
13+
pull Pull an application package from a registry
14+
push Push an application package to a registry
15+
render Render the Compose file for an Application Package
16+
split Split a single-file Docker Application definition into the directory format
17+
status Get the installation status of an application
1818
uninstall Uninstall an application
1919
upgrade Upgrade an installed application
2020
validate Checks the rendered application is syntactically correct

e2e/testdata/plugin-usage.golden

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11

22
Usage: docker app COMMAND
33

4-
Build and deploy Docker Application Packages.
4+
A tool to build and manage Docker Applications.
55

66
Commands:
7-
bundle Create a CNAB invocation image and bundle.json for the application
7+
bundle Create a CNAB invocation image and `bundle.json` for the application
88
completion Generates completion scripts for the specified shell (bash or zsh)
9-
init Start building a Docker application
10-
inspect Shows metadata, parameters and a summary of the compose file for a given application
9+
init Initialize Docker Application definition
10+
inspect Shows metadata, parameters and a summary of the Compose file for a given application
1111
install Install an application
12-
merge Merge a multi-file application into a single file
13-
pull Pull an application from a registry
14-
push Push the application to a registry
15-
render Render the Compose file for the application
16-
split Split a single-file application into multiple files
17-
status Get the installation status. If the installation is a docker application, the status shows the stack services.
12+
merge Merge a directory format Docker Application definition into a single file
13+
pull Pull an application package from a registry
14+
push Push an application package to a registry
15+
render Render the Compose file for an Application Package
16+
split Split a single-file Docker Application definition into the directory format
17+
status Get the installation status of an application
1818
uninstall Uninstall an application
1919
upgrade Upgrade an installed application
2020
validate Checks the rendered application is syntactically correct

examples/voting-app/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ cleanup: cleanup/production cleanup/development
2424
#
2525
render/production: cleanup/production
2626
@mkdir -p $(PRODUCTION_DIR)
27-
docker-app render --parameters-files $(PARAMETERS_DIR)/production.yml > $(PRODUCTION_DIR)/docker-compose.yml
27+
docker-app render --parameters-file $(PARAMETERS_DIR)/production.yml > $(PRODUCTION_DIR)/docker-compose.yml
2828

2929
render/development: cleanup/development
3030
@mkdir -p $(DEVELOPMENT_DIR)
31-
docker-app render --parameters-files $(PARAMETERS_DIR)/development.yml > $(DEVELOPMENT_DIR)/docker-compose.yml
31+
docker-app render --parameters-file $(PARAMETERS_DIR)/development.yml > $(DEVELOPMENT_DIR)/docker-compose.yml
3232

3333
render: render/production render/development
3434

@@ -47,10 +47,10 @@ stop: stop/production stop/development
4747
# Deploy.
4848
#
4949
deploy/production: render/production stop/production
50-
docker-app deploy --parameters-files $(PARAMETERS_DIR)/production.yml
50+
docker-app deploy --parameters-file $(PARAMETERS_DIR)/production.yml
5151

5252
deploy/development: render/development stop/development
53-
docker-app deploy --parameters-files $(PARAMETERS_DIR)/development.yml
53+
docker-app deploy --parameters-file $(PARAMETERS_DIR)/development.yml
5454

5555
#
5656
# Pack.

examples/wordpress/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ volumes:
5454
**Override default parameters with file**. This example sets `debug` to `"false"` and the wordpress service published port to 80 as defined in `prod-parameters.yml`.
5555

5656
```yaml
57-
# docker-app render wordpress --parameters-files prod-parameters.yml
57+
# docker-app render wordpress --parameters-file prod-parameters.yml
5858
version: "3.6"
5959
[...]
6060
environment:

internal/commands/bundle.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ type bundleOptions struct {
2828
func bundleCmd(dockerCli command.Cli) *cobra.Command {
2929
var opts bundleOptions
3030
cmd := &cobra.Command{
31-
Use: "bundle [<app-name>]",
32-
Short: "Create a CNAB invocation image and bundle.json for the application",
33-
Args: cli.RequiresMaxArgs(1),
31+
Use: "bundle [APP_NAME] [--output OUTPUT_FILE]",
32+
Short: "Create a CNAB invocation image and `bundle.json` for the application",
33+
Example: `$ docker app bundle myapp.dockerapp`,
34+
Args: cli.RequiresMaxArgs(1),
3435
RunE: func(cmd *cobra.Command, args []string) error {
3536
return runBundle(dockerCli, firstOrEmpty(args), opts)
3637
},
3738
}
3839

39-
cmd.Flags().StringVarP(&opts.out, "output", "o", "bundle.json", "path to the output bundle.json (- for stdout)")
40+
cmd.Flags().StringVarP(&opts.out, "output", "o", "bundle.json", "Output file (- for stdout)")
4041
return cmd
4142
}
4243

internal/commands/completion.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ func completionCmd(dockerCli command.Cli, rootCmd *cobra.Command) *cobra.Command
1414
return &cobra.Command{
1515
Use: "completion SHELL",
1616
Short: "Generates completion scripts for the specified shell (bash or zsh)",
17-
Long: `# Load the docker-app completion code for bash into the current shell
18-
. <(docker-app completion bash)
19-
# Set the docker-app completion code for bash to autoload on startup in your ~/.bashrc,
17+
Long: `# Load the "docker app" completion code for bash into the current shell
18+
. <(docker app completion bash)
19+
# Set the "docker app" completion code for bash to autoload on startup in your ~/.bashrc,
2020
# ~/.profile or ~/.bash_profile
21-
. <(docker-app completion bash)
21+
. <(docker app completion bash)
2222
# Note: bash-completion is needed.
2323
24-
# Load the docker-app completion code for zsh into the current shell
25-
source <(docker-app completion zsh)
26-
# Set the docker-app completion code for zsh to autoload on startup in your ~/.zshrc
27-
source <(docker-app completion zsh)
24+
# Load the "docker app" completion code for zsh into the current shell
25+
source <(docker app completion zsh)
26+
# Set the "docker app" completion code for zsh to autoload on startup in your ~/.zshrc,
27+
source <(docker app completion zsh)
2828
`,
29-
Args: cli.RequiresMaxArgs(1),
29+
Example: `$ . <(docker app completion bash)`,
30+
Args: cli.RequiresMaxArgs(1),
3031
RunE: func(cmd *cobra.Command, args []string) error {
3132
switch {
3233
case len(args) == 0:

internal/commands/init.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ var (
1515

1616
func initCmd() *cobra.Command {
1717
cmd := &cobra.Command{
18-
Use: "init <app-name> [-c <compose-file>] [-d <description>] [-m name:email ...]",
19-
Short: "Start building a Docker application",
20-
Long: `Start building a Docker application. Will automatically detect a docker-compose.yml file in the current directory.`,
21-
Args: cli.ExactArgs(1),
18+
Use: "init APP_NAME [--compose-file COMPOSE_FILE] [--description DESCRIPTION] [--maintainer NAME:EMAIL ...] [OPTIONS]",
19+
Short: "Initialize Docker Application definition",
20+
Long: `Start building a Docker Application package. If there is a docker-compose.yml file in the current directory it will be copied and used.`,
21+
Example: `$ docker app init myapp --description "a useful description"`,
22+
Args: cli.ExactArgs(1),
2223
RunE: func(cmd *cobra.Command, args []string) error {
2324
return packager.Init(args[0], initComposeFile, initDescription, initMaintainers, initSingleFile)
2425
},
2526
}
26-
cmd.Flags().StringVarP(&initComposeFile, "compose-file", "c", "", "Initial Compose file (optional)")
27-
cmd.Flags().StringVarP(&initDescription, "description", "d", "", "Initial description (optional)")
28-
cmd.Flags().StringArrayVarP(&initMaintainers, "maintainer", "m", []string{}, "Maintainer (name:email) (optional)")
29-
cmd.Flags().BoolVarP(&initSingleFile, "single-file", "s", false, "Create a single-file application")
27+
cmd.Flags().StringVar(&initComposeFile, "compose-file", "", "Compose file to use as application base (optional)")
28+
cmd.Flags().StringVar(&initDescription, "description", "", "Human readable description of your application (optional)")
29+
cmd.Flags().StringArrayVar(&initMaintainers, "maintainer", []string{}, "Name and email address of person responsible for the application (name:email) (optional)")
30+
cmd.Flags().BoolVar(&initSingleFile, "single-file", false, "Create a single-file Docker Application definition")
3031
return cmd
3132
}

0 commit comments

Comments
 (0)