-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: re-add support for legacy commands
- Loading branch information
Showing
2 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/docker" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var inspectCmd = &cobra.Command{ | ||
Use: "inspect [OPTIONS] NAME|ID [NAME|ID...]", | ||
Short: "Return low-level information on Docker objects", | ||
Hidden: os.Getenv("DOCKER_HIDE_LEGACY_COMMANDS") == "1", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(inspectCmd).Standalone() | ||
inspectCmd.Flags().StringP("format", "f", "", "Format output using a custom template:") | ||
inspectCmd.Flags().BoolP("size", "s", false, "Display total file sizes if the type is container") | ||
inspectCmd.Flags().String("type", "", "Return JSON for specified type") | ||
rootCmd.AddCommand(inspectCmd) | ||
|
||
carapace.Gen(inspectCmd).PositionalAnyCompletion( | ||
carapace.Batch( | ||
docker.ActionContainers(), | ||
docker.ActionNetworks(), | ||
docker.ActionNodes().Suppress("This node is not a swarm manager"), | ||
docker.ActionRepositoryTags(), | ||
docker.ActionSecrets().Suppress("This node is not a swarm manager"), | ||
docker.ActionServices().Suppress("This node is not a swarm manager"), | ||
docker.ActionVolumes(), | ||
).ToA(), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters