CLI: Fix erroneous warning when reading from stdin (#17252)
This commit is contained in:
parent
2c8e88ab67
commit
b0a580de47
|
@ -296,7 +296,8 @@ func parseFlagFile(raw string) (string, error) {
|
|||
func generateFlagWarnings(args []string) string {
|
||||
var trailingFlags []string
|
||||
for _, arg := range args {
|
||||
if !strings.HasPrefix(arg, "-") {
|
||||
// "-" can be used where a file is expected to denote stdin.
|
||||
if !strings.HasPrefix(arg, "-") || arg == "-" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,10 @@ func TestArgWarnings(t *testing.T) {
|
|||
[]string{"--x=" + globalFlagDetailed},
|
||||
"--x=" + globalFlagDetailed,
|
||||
},
|
||||
{
|
||||
[]string{"policy", "write", "my-policy", "-"},
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
|
|
Loading…
Reference in New Issue