Trims whitespace from command arguments in RootCmd (#24218)

- Prevents commands from receiving potential whitespace characters
- Adds a new root test case ensuring various whitespace characters are removed

Co-authored-by: Nathan Geist <ngeist@spiria.com>
Этот коммит содержится в:
Nathan
2023-08-17 02:19:09 -06:00
коммит произвёл GitHub
родитель 7b164d4f82
Коммит 44f3482fee
2 изменённых файлов: 51 добавлений и 0 удалений

Просмотреть файл

@@ -73,6 +73,9 @@ var RootCmd = &cobra.Command{
Long: `Mattermost offers workplace messaging across web, PC and phones with archiving, search and integration with your existing systems. Documentation available at https://docs.mattermost.com`,
DisableAutoGenTag: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
for i, arg := range args {
args[i] = strings.TrimSpace(arg)
}
format := viper.GetString("format")
if viper.GetBool("disable-pager") {
printer.OverrideEnablePager(false)