Skip to content

Commit

Permalink
docker: hide legacy commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 6, 2023
1 parent e3a77fe commit 122e6b5
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 148 deletions.
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var builderCmd = &cobra.Command{
Use: "builder",
Short: "Manage builds",
Run: func(cmd *cobra.Command, args []string) {},
Use: "builder",
Short: "Manage builds",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var configCmd = &cobra.Command{
Use: "config",
Short: "Manage Docker configs",
Run: func(cmd *cobra.Command, args []string) {},
Use: "config",
Short: "Manage Docker configs",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var containerCmd = &cobra.Command{
Use: "container",
Short: "Manage containers",
Run: func(cmd *cobra.Command, args []string) {},
Use: "container",
Short: "Manage containers",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var contextCmd = &cobra.Command{
Use: "context",
Short: "Manage contexts",
Run: func(cmd *cobra.Command, args []string) {},
Use: "context",
Short: "Manage contexts",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
18 changes: 0 additions & 18 deletions completers/docker_completer/cmd/engine.go

This file was deleted.

30 changes: 0 additions & 30 deletions completers/docker_completer/cmd/engine_activate.go

This file was deleted.

26 changes: 0 additions & 26 deletions completers/docker_completer/cmd/engine_check.go

This file was deleted.

22 changes: 0 additions & 22 deletions completers/docker_completer/cmd/engine_update.go

This file was deleted.

7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var imageCmd = &cobra.Command{
Use: "image",
Short: "Manage images",
Run: func(cmd *cobra.Command, args []string) {},
Use: "image",
Short: "Manage images",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
)

var inspectCmd = &cobra.Command{
Use: "inspect",
Short: "Return low-level information on Docker objects",
Run: func(cmd *cobra.Command, args []string) {},
Use: "inspect",
Short: "Return low-level information on Docker objects",
Hidden: true, // TODO legacy
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var networkCmd = &cobra.Command{
Use: "network",
Short: "Manage networks",
Run: func(cmd *cobra.Command, args []string) {},
Use: "network",
Short: "Manage networks",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var nodeCmd = &cobra.Command{
Use: "node",
Short: "Manage Swarm nodes",
Run: func(cmd *cobra.Command, args []string) {},
Use: "node",
Short: "Manage Swarm nodes",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var pluginCmd = &cobra.Command{
Use: "plugin",
Short: "Manage plugins",
Run: func(cmd *cobra.Command, args []string) {},
Use: "plugin",
Short: "Manage plugins",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
8 changes: 8 additions & 0 deletions completers/docker_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ func Execute() error {
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.AddGroup(&cobra.Group{ID: "management", Title: "Management Commands"})

rootCmd.Flags().String("config", "", "Location of client config files (default \"/home/user/.docker\")")
rootCmd.Flags().StringP("context", "c", "", "Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with \"docker context use\")")
rootCmd.Flags().BoolP("debug", "D", false, "Enable debug mode")
Expand Down Expand Up @@ -55,6 +57,7 @@ func init() {
pluginCmd := &cobra.Command{
Use: name,
Short: description,
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
DisableFlagParsing: true,
}
Expand All @@ -76,6 +79,11 @@ func init() {

func rootAlias(cmd *cobra.Command, initCompletion func(cmd *cobra.Command, isAlias bool)) {
aliasCmd := *cmd
switch aliasCmd.Name() {
case "build", "run":
default:
aliasCmd.Hidden = true // hide legacy commands
}
rootCmd.AddCommand(&aliasCmd)

for i, c := range []*cobra.Command{cmd, &aliasCmd} {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var secretCmd = &cobra.Command{
Use: "secret",
Short: "Manage Docker secrets",
Run: func(cmd *cobra.Command, args []string) {},
Use: "secret",
Short: "Manage Docker secrets",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var serviceCmd = &cobra.Command{
Use: "service",
Short: "Manage services",
Run: func(cmd *cobra.Command, args []string) {},
Use: "service",
Short: "Manage services",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var stackCmd = &cobra.Command{
Use: "stack",
Short: "Manage Docker stacks",
Run: func(cmd *cobra.Command, args []string) {},
Use: "stack",
Short: "Manage Docker stacks",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var swarmCmd = &cobra.Command{
Use: "swarm",
Short: "Manage Swarm",
Run: func(cmd *cobra.Command, args []string) {},
Use: "swarm",
Short: "Manage Swarm",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var systemCmd = &cobra.Command{
Use: "system",
Short: "Manage Docker",
Run: func(cmd *cobra.Command, args []string) {},
Use: "system",
Short: "Manage Docker",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/trust.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var trustCmd = &cobra.Command{
Use: "trust",
Short: "Manage trust on Docker images",
Run: func(cmd *cobra.Command, args []string) {},
Use: "trust",
Short: "Manage trust on Docker images",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions completers/docker_completer/cmd/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
)

var volumeCmd = &cobra.Command{
Use: "volume",
Short: "Manage volumes",
Run: func(cmd *cobra.Command, args []string) {},
Use: "volume",
Short: "Manage volumes",
GroupID: "management",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
Expand Down
8 changes: 4 additions & 4 deletions completers/rsync_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func init() {
return carapace.ActionMultiParts(":", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 0:
return os.ActionUsers().Invoke(c).Suffix(":").ToA()
return os.ActionUsers().Suffix(":")
default:
return carapace.ActionValues()
}
Expand All @@ -259,11 +259,11 @@ func init() {
switch len(c.Parts) {
case 0:
return carapace.Batch(
os.ActionUsers().Invoke(c).Suffix("@").ToA(),
net.ActionHosts().Invoke(c).Suffix(":").ToA(),
os.ActionUsers().Suffix("@"),
net.ActionHosts().Suffix(":"),
).ToA()
case 1:
return net.ActionHosts().Invoke(c).Suffix(":").ToA()
return net.ActionHosts().Suffix(":")
default:
return carapace.ActionValues()
}
Expand Down

0 comments on commit 122e6b5

Please sign in to comment.