Disallow use of --include-content without --filter
This commit is contained in:
parent
73af9f8bd9
commit
b56353dc02
2 changed files with 11 additions and 0 deletions
|
|
@ -65,6 +65,12 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
|
|||
return cmdutil.FlagErrorf("invalid limit: %v", opts.Limit)
|
||||
}
|
||||
|
||||
if flagFilter == "" {
|
||||
if opts.IncludeContent {
|
||||
return cmdutil.FlagErrorf("cannot use --include-content without --filter")
|
||||
}
|
||||
}
|
||||
|
||||
if filter, err := regexp.CompilePOSIX(flagFilter); err != nil {
|
||||
return err
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,11 @@ func TestNewCmdList(t *testing.T) {
|
|||
cli: "--filter octo(",
|
||||
wantsErr: true,
|
||||
},
|
||||
{
|
||||
name: "include content without filter",
|
||||
cli: "--include-content",
|
||||
wantsErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue