Skip to content

Commit

Permalink
label list: add --name-only flag
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonrcarter committed Feb 4, 2022
1 parent e5c1c1f commit 51ea997
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/label_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var labelListCmd = &cobra.Command{
log.Fatal(err)
}

nameOnly, err := cmd.Flags().GetBool("name-only")
if err != nil {
log.Fatal(err)
}

labelSearch = strings.ToLower(labelSearch)

labels, err := lab.LabelList(rn)
Expand All @@ -45,7 +50,7 @@ var labelListCmd = &cobra.Command{
}

description := ""
if label.Description != "" {
if !nameOnly && label.Description != "" {
description = " - " + label.Description
}

Expand Down Expand Up @@ -79,6 +84,7 @@ func mapLabels(rn string, labelTerms []string) ([]string, error) {
}

func init() {
labelListCmd.Flags().Bool("name-only", false, "only list label names, not descriptions")
labelCmd.AddCommand(labelListCmd)
carapace.Gen(labelCmd).PositionalCompletion(
action.Remotes(),
Expand Down

0 comments on commit 51ea997

Please sign in to comment.