diff --git a/cmd/crowdsec-cli/clihub/items.go b/cmd/crowdsec-cli/clihub/items.go index f86fe65a2a1..ef3127033ac 100644 --- a/cmd/crowdsec-cli/clihub/items.go +++ b/cmd/crowdsec-cli/clihub/items.go @@ -97,7 +97,7 @@ func ListItems(out io.Writer, wantColor string, itemTypes []string, items map[st Name: item.Name, LocalVersion: item.State.LocalVersion, LocalPath: item.State.LocalPath, - Description: item.Description, + Description: strings.TrimSpace(item.Description), Status: status, UTF8Status: fmt.Sprintf("%v %s", statusEmo, status), } @@ -128,7 +128,7 @@ func ListItems(out io.Writer, wantColor string, itemTypes []string, items map[st item.Name, item.State.Text(), item.State.LocalVersion, - item.Description, + strings.TrimSpace(item.Description), } if len(itemTypes) > 1 { row = append(row, itemType) diff --git a/test/bats/20_hub_scenarios.bats b/test/bats/20_hub_scenarios.bats index 3ab3d944c93..b5f3a642233 100644 --- a/test/bats/20_hub_scenarios.bats +++ b/test/bats/20_hub_scenarios.bats @@ -85,7 +85,8 @@ teardown() { list_human=$(cscli scenarios list -o human -a | tail -n +6 | head -n -1 | cut -d' ' -f2) list_json=$(cscli scenarios list -o json -a | jq -r '.scenarios[].name') - rune -0 sort -f <<<"$list_raw" + # use python to sort because it handles "_" like go + rune -0 python3 -c 'import sys; print("".join(sorted(sys.stdin.readlines(), key=str.casefold)), end="")' <<<"$list_raw" assert_output "$list_raw" assert_equal "$list_raw" "$list_json"