Handle linebreaks in custom completions. (#1162)
If a command/flag description contains a linebreak then the shell completion script will interpret this as new command/flag. To fix this we only use the first line from the description in the output. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
@ -561,7 +561,7 @@ func TestFlagNameCompletionInGoWithDesc(t *testing.T) {
|
||||
}
|
||||
rootCmd.AddCommand(childCmd)
|
||||
|
||||
rootCmd.Flags().IntP("first", "f", -1, "first flag")
|
||||
rootCmd.Flags().IntP("first", "f", -1, "first flag\nlonger description for flag")
|
||||
rootCmd.PersistentFlags().BoolP("second", "s", false, "second flag")
|
||||
childCmd.Flags().String("subFlag", "", "sub flag")
|
||||
|
||||
|
Reference in New Issue
Block a user