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

Commit 6e215e7

Browse files
Merge pull request #704 from carolinebriaud/fix-usages-examples
Consistent object naming in usage command and examples
2 parents e5b6e29 + b07e744 commit 6e215e7

File tree

19 files changed

+85
-76
lines changed

19 files changed

+85
-76
lines changed

e2e/commands_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func TestRunOnlyOne(t *testing.T) {
190190
cmd.Command = dockerCli.Command("app", "run", "--cnab-bundle-json", "bundle.json", "myapp")
191191
icmd.RunCmd(cmd).Assert(t, icmd.Expected{
192192
ExitCode: 1,
193-
Err: `"docker app run" cannot run a bundle and an app image`,
193+
Err: `"docker app run" cannot run a bundle and an App image`,
194194
})
195195
}
196196

@@ -238,7 +238,7 @@ func testDockerAppLifecycle(t *testing.T, useBindMount bool) {
238238
cmd.Command = dockerCli.Command("app", "update", appName)
239239
icmd.RunCmd(cmd).Assert(t, icmd.Expected{
240240
ExitCode: 1,
241-
Err: fmt.Sprintf("Installation %q has failed and cannot be updated, reinstall it using 'docker app install'", appName),
241+
Err: fmt.Sprintf("Installation %q has failed and cannot be updated, reinstall it using 'docker app run'", appName),
242242
})
243243

244244
// Install a Docker Application Package with an existing failed installation is fine

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 (Docker Inc.,",
18+
Out: "app* Docker App (Docker Inc.,",
1919
})
2020

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

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

e2e/testdata/plugin-usage.golden

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

22
Usage: docker app [OPTIONS] COMMAND
33

4-
A tool to build and manage Docker Applications.
4+
A tool to build, share and run a Docker App
55

66
Options:
77
--version Print version information
88

99
Management Commands:
10-
image Manage application images
10+
image Manage App images
1111

1212
Commands:
13-
build Build service images for the application
14-
init Initialize Docker Application definition
15-
ls List the installations and their last known installation result
16-
pull Pull an application package from a registry
17-
push Push an application package to a registry
18-
rm Remove an application
19-
run Run an application
20-
update Update a running application
21-
validate Checks the rendered application is syntactically correct
13+
build Build an App image from an App definition (.dockerapp)
14+
init Initialize an App definition
15+
ls List running Apps
16+
pull Pull an App image from a registry
17+
push Push an App image to a registry
18+
rm Remove a running App
19+
run Run an App from an App image
20+
update Update a running App
21+
validate Check that an App definition (.dockerapp) is syntactically correct
2222

2323
Run 'docker app COMMAND --help' for more information on a command.

internal/commands/build/build.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,25 @@ type buildOptions struct {
4545
func Cmd(dockerCli command.Cli) *cobra.Command {
4646
var opts buildOptions
4747
cmd := &cobra.Command{
48-
Use: "build [OPTIONS] [CONTEXT_PATH]",
49-
Short: "Build service images for the application",
50-
Example: `$ docker app build --tag my/app:1.0.0 .`,
51-
Args: cli.ExactArgs(1),
48+
Use: "build [OPTIONS] [BUILD_PATH]",
49+
Short: "Build an App image from an App definition (.dockerapp)",
50+
Example: `$ docker app build .
51+
$ docker app build . -f myapp.dockerapp -t myrepo/myapp:1.0.0`,
52+
Args: cli.ExactArgs(1),
5253
RunE: func(cmd *cobra.Command, args []string) error {
5354
return runBuild(dockerCli, args[0], opts)
5455
},
5556
}
5657

5758
flags := cmd.Flags()
58-
flags.BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the image")
59+
flags.BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the App image")
5960
flags.StringVar(&opts.progress, "progress", "auto", "Set type of progress output (auto, plain, tty). Use plain to show container output")
60-
flags.StringVarP(&opts.tag, "tag", "t", "", "Application image and optionally a tag in the 'image:tag' format")
61-
flags.StringVarP(&opts.folder, "folder", "f", "", "Docker app folder containing application definition")
62-
flags.BoolVar(&opts.pull, "pull", false, "Always attempt to pull a newer version of the image")
61+
flags.StringVarP(&opts.tag, "tag", "t", "", "App image tag, optionally in the 'repo:tag' format")
62+
flags.StringVarP(&opts.folder, "folder", "f", "", "App definition as a .dockerapp directory")
63+
flags.BoolVar(&opts.pull, "pull", false, "Always attempt to pull a newer version of the App image")
6364
flags.StringArrayVar(&opts.args, "build-arg", []string{}, "Set build-time variables")
64-
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the build output and print app image ID on success")
65-
flags.StringVar(&opts.imageIDFile, "iidfile", "", "Write the app image ID to the file")
65+
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Suppress the build output and print App image ID on success")
66+
flags.StringVar(&opts.imageIDFile, "iidfile", "", "Write the App image ID to the file")
6667

6768
return cmd
6869
}
@@ -190,7 +191,7 @@ func getAppFolder(opt buildOptions, contextPath string) (string, error) {
190191
for _, f := range files {
191192
if strings.HasSuffix(f.Name(), ".dockerapp") {
192193
if application != "" {
193-
return "", fmt.Errorf("%s contains multiple *.dockerapp folders, use -f option to select the one to build", contextPath)
194+
return "", fmt.Errorf("%s contains multiple .dockerapp directories, use -f option to select the one to build", contextPath)
194195
}
195196
application = filepath.Join(contextPath, f.Name())
196197
if !f.IsDir() {

internal/commands/image/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
// Cmd is the image top level command
99
func Cmd(dockerCli command.Cli) *cobra.Command {
1010
cmd := &cobra.Command{
11-
Short: "Manage application images",
11+
Short: "Manage App images",
1212
Use: "image",
1313
}
1414

internal/commands/image/inspect.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ func muteDockerCli(dockerCli command.Cli) func() {
3030
func inspectCmd(dockerCli command.Cli) *cobra.Command {
3131
var opts inspectOptions
3232
cmd := &cobra.Command{
33-
Use: "inspect [APP_NAME] [OPTIONS]",
34-
Short: "Shows metadata, parameters and a summary of the Compose file for a given application",
35-
Example: `$ docker app inspect my-installed-app
36-
$docker app inspect my-app:1.0.0`,
33+
Use: "inspect [OPTIONS] APP_IMAGE",
34+
Short: "Display detailed information about an App image",
35+
Example: `$ docker app image inspect myapp
36+
$ docker app image inspect myapp:1.0.0
37+
$ docker app image inspect myrepo/myapp:1.0.0
38+
$ docker app image inspect 34be4a0c5f50`,
3739
Args: cli.ExactArgs(1),
3840
RunE: func(cmd *cobra.Command, args []string) error {
3941
return runInspect(dockerCli, args[0], opts)
4042
},
4143
}
42-
cmd.Flags().BoolVar(&opts.pretty, "pretty", false, "Pretty print the output")
44+
cmd.Flags().BoolVar(&opts.pretty, "pretty", false, "Print the information in a human friendly format")
4345

4446
return cmd
4547
}

internal/commands/image/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type imageListOption struct {
2323
func listCmd(dockerCli command.Cli) *cobra.Command {
2424
options := imageListOption{}
2525
cmd := &cobra.Command{
26-
Short: "List application images",
26+
Short: "List App images",
2727
Use: "ls",
2828
Aliases: []string{"list"},
2929
RunE: func(cmd *cobra.Command, args []string) error {

internal/commands/image/rm.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ import (
1414

1515
func rmCmd() *cobra.Command {
1616
return &cobra.Command{
17-
Short: "Remove an application image",
18-
Use: "rm [APP_IMAGE] [APP_IMAGE...]",
17+
Short: "Remove an App image",
18+
Use: "rm APP_IMAGE [APP_IMAGE...]",
1919
Aliases: []string{"remove"},
2020
Args: cli.RequiresMinArgs(1),
2121
Example: `$ docker app image rm myapp
2222
$ docker app image rm myapp:1.0.0
23-
$ docker app image rm docker.io/library/myapp@sha256:beef...`,
23+
$ docker app image rm myrepo/myapp@sha256:c0de...
24+
$ docker app image rm 34be4a0c5f50`,
2425
RunE: func(cmd *cobra.Command, args []string) error {
2526
appstore, err := store.NewApplicationStore(config.Dir())
2627
if err != nil {

internal/commands/image/tag.go

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

1313
func tagCmd() *cobra.Command {
1414
cmd := &cobra.Command{
15-
Short: "Create a new tag from an application image",
15+
Short: "Create a new tag from an App image",
1616
Use: "tag SOURCE_APP_IMAGE[:TAG] TARGET_APP_IMAGE[:TAG]",
17-
Args: cli.ExactArgs(2),
17+
Example: `$ docker app image tag myapp myrepo/myapp:mytag
18+
$ docker app image tag myapp:tag myrepo/mynewapp:mytag
19+
$ docker app image tag 34be4a0c5f50 myrepo/mynewapp:mytag`,
20+
Args: cli.ExactArgs(2),
1821
RunE: func(cmd *cobra.Command, args []string) error {
1922
appstore, err := store.NewApplicationStore(config.Dir())
2023
if err != nil {

internal/commands/init.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ var (
1515

1616
func initCmd(dockerCli command.Cli) *cobra.Command {
1717
cmd := &cobra.Command{
18-
Use: "init APP_NAME [--compose-file COMPOSE_FILE] [OPTIONS]",
19-
Short: "Initialize Docker Application definition",
20-
Long: `Start building a Docker Application package.`,
21-
Example: `$ docker app init myapp`,
22-
Args: cli.ExactArgs(1),
18+
Use: "init [OPTIONS] APP_DEFINITION",
19+
Short: "Initialize an App definition",
20+
Example: `$ docker app init myapp
21+
$ docker app init myapp --compose-file docker-compose.yml`,
22+
Args: cli.ExactArgs(1),
2323
RunE: func(cmd *cobra.Command, args []string) error {
2424
created, err := packager.Init(args[0], initComposeFile)
2525
if err != nil {
@@ -29,6 +29,6 @@ func initCmd(dockerCli command.Cli) *cobra.Command {
2929
return nil
3030
},
3131
}
32-
cmd.Flags().StringVar(&initComposeFile, "compose-file", "", "Compose file to use as application base (optional)")
32+
cmd.Flags().StringVar(&initComposeFile, "compose-file", "", "Compose file to use to bootstrap a Docker App definition")
3333
return cmd
3434
}

0 commit comments

Comments
 (0)