Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/command/system/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {

flags := cmd.Flags()
flags.StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
flags.StringVar(&opts.objectType, "type", "", "Only inspect objects of the given type")
flags.StringVar(&opts.objectType, "type", "", `Only inspect objects of the given type ("`+strings.Join(allTypes, `", "`)+`")`)
flags.BoolVarP(&opts.size, "size", "s", false, "Display total file sizes if the type is container")

_ = cmd.RegisterFlagCompletionFunc("type", completion.FromList(allTypes...))
Expand Down
10 changes: 10 additions & 0 deletions cli/command/system/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ func TestInspectValidateFlagsAndArgs(t *testing.T) {
})
}
}

func TestInspectTypeFlagHelpListsObjectTypes(t *testing.T) {
cmd := newInspectCommand(test.NewFakeCli(&fakeClient{}))
typeFlag := cmd.Flags().Lookup("type")
assert.Assert(t, typeFlag != nil)
usage := typeFlag.Usage
for _, objectType := range allTypes {
assert.Check(t, is.Contains(usage, objectType), "help should mention %q", objectType)
}
}