mirror of
https://github.com/docker/compose.git
synced 2025-07-27 07:34:10 +02:00
Merge pull request #111 from chris-crone/context-show-no-global
Do not pass global flags to context show
This commit is contained in:
commit
485078cbb8
@ -46,7 +46,7 @@ func Command(opts *cliopts.GlobalOpts) *cobra.Command {
|
|||||||
createCommand(),
|
createCommand(),
|
||||||
listCommand(),
|
listCommand(),
|
||||||
removeCommand(),
|
removeCommand(),
|
||||||
showCommand(opts),
|
showCommand(),
|
||||||
useCommand(opts),
|
useCommand(opts),
|
||||||
login.Command(),
|
login.Command(),
|
||||||
)
|
)
|
||||||
|
@ -33,27 +33,26 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
cliopts "github.com/docker/api/cli/options"
|
|
||||||
apicontext "github.com/docker/api/context"
|
apicontext "github.com/docker/api/context"
|
||||||
"github.com/docker/api/context/store"
|
"github.com/docker/api/context/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func showCommand(opts *cliopts.GlobalOpts) *cobra.Command {
|
func showCommand() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "show",
|
Use: "show",
|
||||||
Short: "Print the current context",
|
Short: "Print the current context",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
return runShow(cmd.Context(), opts)
|
return runShow(cmd.Context())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runShow(ctx context.Context, opts *cliopts.GlobalOpts) error {
|
func runShow(ctx context.Context) error {
|
||||||
s := store.ContextStore(ctx)
|
|
||||||
name := apicontext.CurrentContext(ctx)
|
name := apicontext.CurrentContext(ctx)
|
||||||
// Match behavior of existing CLI
|
// Match behavior of existing CLI
|
||||||
if name != store.DefaultContextName {
|
if name != store.DefaultContextName {
|
||||||
|
s := store.ContextStore(ctx)
|
||||||
if _, err := s.Get(name, nil); err != nil {
|
if _, err := s.Get(name, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user