This repository was archived by the owner on Jul 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 11 files changed +25
-20
lines changed Expand file tree Collapse file tree 11 files changed +25
-20
lines changed Original file line number Diff line number Diff line change 5
5
"os"
6
6
"strings"
7
7
8
+ "github.com/docker/cli/cli"
8
9
"github.com/docker/lunchbox/internal"
9
10
"github.com/docker/lunchbox/renderer"
10
11
"github.com/spf13/cobra"
@@ -13,7 +14,7 @@ import (
13
14
var helmCmd = & cobra.Command {
14
15
Use : "helm <app-name> [-c <compose-files>...] [-e key=value...] [-f settings-file...]" ,
15
16
Short : "Render the Compose file for this app as an Helm package" ,
16
- Args : cobra . MaximumNArgs (1 ),
17
+ Args : cli . RequiresMaxArgs (1 ),
17
18
RunE : func (cmd * cobra.Command , args []string ) error {
18
19
d := make (map [string ]string )
19
20
for _ , v := range helmEnv {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package cmd
3
3
import (
4
4
"fmt"
5
5
6
+ "github.com/docker/cli/cli"
6
7
"github.com/docker/lunchbox/packager"
7
8
"github.com/spf13/cobra"
8
9
)
@@ -11,7 +12,7 @@ import (
11
12
var initCmd = & cobra.Command {
12
13
Use : "init <app-name> [-c <compose-file>]" ,
13
14
Short : "Initialize an app package in the current working directory" ,
14
- Args : cobra .ExactArgs (1 ),
15
+ Args : cli .ExactArgs (1 ),
15
16
RunE : func (cmd * cobra.Command , args []string ) error {
16
17
fmt .Println ("init called" )
17
18
return packager .Init (args [0 ], composeFile )
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/packager"
5
6
"github.com/spf13/cobra"
6
7
)
@@ -9,7 +10,7 @@ import (
9
10
var inspectCmd = & cobra.Command {
10
11
Use : "inspect <app-name>" ,
11
12
Short : "Retrieve metadata for a given app package" ,
12
- Args : cobra . MaximumNArgs (1 ),
13
+ Args : cli . RequiresMaxArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
app := ""
15
16
if len (args ) > 0 {
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/internal"
5
6
"github.com/docker/lunchbox/packager"
6
7
"github.com/spf13/cobra"
@@ -9,7 +10,7 @@ import (
9
10
var loadCmd = & cobra.Command {
10
11
Use : "load <repotag>" ,
11
12
Short : "Load an app from docker" ,
12
- Args : cobra . MaximumNArgs (1 ),
13
+ Args : cli . RequiresMaxArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
app := ""
15
16
if len (args ) > 0 {
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/internal"
5
6
"github.com/docker/lunchbox/packager"
6
7
"github.com/spf13/cobra"
@@ -9,7 +10,7 @@ import (
9
10
var packCmd = & cobra.Command {
10
11
Use : "pack <app-name> [-o output_file]" ,
11
12
Short : "Pack this app as a single file" ,
12
- Args : cobra . MaximumNArgs (1 ),
13
+ Args : cli . RequiresMaxArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
app := ""
15
16
if len (args ) > 0 {
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/internal"
5
6
"github.com/docker/lunchbox/packager"
6
7
"github.com/spf13/cobra"
@@ -9,7 +10,7 @@ import (
9
10
var pullCmd = & cobra.Command {
10
11
Use : "pull <repotag>" ,
11
12
Short : "Pull an app from a registry" ,
12
- Args : cobra .ExactArgs (1 ),
13
+ Args : cli .ExactArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
return packager .Pull (args [0 ])
15
16
},
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/internal"
5
6
"github.com/docker/lunchbox/packager"
6
7
"github.com/spf13/cobra"
@@ -9,7 +10,7 @@ import (
9
10
var pushCmd = & cobra.Command {
10
11
Use : "push <app-name>" ,
11
12
Short : "Push the application to a registry" ,
12
- Args : cobra . MaximumNArgs (1 ),
13
+ Args : cli . RequiresMaxArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
if pushTag == "" {
15
16
pushTag = "latest"
Original file line number Diff line number Diff line change 5
5
"os"
6
6
"strings"
7
7
8
+ "github.com/docker/cli/cli"
8
9
"github.com/docker/lunchbox/internal"
9
10
"github.com/docker/lunchbox/renderer"
10
11
"github.com/spf13/cobra"
@@ -21,7 +22,7 @@ Override is provided in different ways:
21
22
- Individual settings values can be passed directly on the command line with the
22
23
-s flag. These value takes precedence over all settings files.
23
24
` ,
24
- Args : cobra . MaximumNArgs (1 ),
25
+ Args : cli . RequiresMaxArgs (1 ),
25
26
RunE : func (cmd * cobra.Command , args []string ) error {
26
27
d := make (map [string ]string )
27
28
for _ , v := range renderEnv {
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
- "fmt"
5
- "os"
6
-
7
4
"github.com/spf13/cobra"
8
5
)
9
6
10
7
// rootCmd represents the base command when called without any subcommands
11
8
var rootCmd = & cobra.Command {
12
- Use : "docker-app" ,
13
- Short : "Docker App Packages" ,
14
- Long : "" ,
9
+ Use : "docker-app" ,
10
+ Short : "Docker App Packages" ,
11
+ Long : "" ,
12
+ SilenceUsage : true ,
15
13
}
16
14
17
15
// Execute adds all child commands to the root command and sets flags appropriately.
18
16
// This is called by main.main(). It only needs to happen once to the rootCmd.
19
17
func Execute () {
20
- if err := rootCmd .Execute (); err != nil {
21
- fmt .Println (err )
22
- os .Exit (1 )
23
- }
18
+ rootCmd .Execute ()
24
19
}
25
20
26
21
func init () {
Original file line number Diff line number Diff line change 1
1
package cmd
2
2
3
3
import (
4
+ "github.com/docker/cli/cli"
4
5
"github.com/docker/lunchbox/internal"
5
6
"github.com/docker/lunchbox/packager"
6
7
"github.com/spf13/cobra"
@@ -9,7 +10,7 @@ import (
9
10
var saveCmd = & cobra.Command {
10
11
Use : "save <app-name>" ,
11
12
Short : "Save the application to docker (in preparation for push)" ,
12
- Args : cobra . MaximumNArgs (1 ),
13
+ Args : cli . RequiresMaxArgs (1 ),
13
14
RunE : func (cmd * cobra.Command , args []string ) error {
14
15
if saveTag == "" {
15
16
saveTag = "latest"
You can’t perform that action at this time.
0 commit comments