Skip to content

Commit

Permalink
Merge pull request #1945 from rsteube/git-interprettrailers
Browse files Browse the repository at this point in the history
git: interpret-trailers
  • Loading branch information
rsteube authored Oct 29, 2023
2 parents 2796eff + b08c89e commit f67da5f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
39 changes: 39 additions & 0 deletions completers/git_completer/cmd/interpretTrailers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var interpretTrailerCmd = &cobra.Command{
Use: "interpret-trailer",
Short: "Add or parse structured information in commit messages",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_low_level_helper].ID,
}

func init() {
carapace.Gen(interpretTrailerCmd).Standalone()

interpretTrailerCmd.Flags().String("if-exists", "", "action if trailer already exists")
interpretTrailerCmd.Flags().Bool("in-place", false, "edit files in place")
interpretTrailerCmd.Flags().Bool("no-divider", false, "do not treat --- specially")
interpretTrailerCmd.Flags().Bool("only-input", false, "do not apply config rules")
interpretTrailerCmd.Flags().Bool("only-trailers", false, "output only the trailers")
interpretTrailerCmd.Flags().Bool("parse", false, "set parsing options")
interpretTrailerCmd.Flags().String("trailer", "", "trailer(s) to add")
interpretTrailerCmd.Flags().Bool("trim-empty", false, "trim empty trailers")
interpretTrailerCmd.Flags().Bool("unfold", false, "join whitespace-continued values")
interpretTrailerCmd.Flags().String("where", "", "where to place the new trailer")
rootCmd.AddCommand(interpretTrailerCmd)

carapace.Gen(interpretTrailerCmd).FlagCompletion(carapace.ActionMap{
"if-exists": carapace.ActionValues("addIfDifferent", "addIfDifferentNeighbor", "add", "replace", "doNothing"),
"trailer": carapace.ActionValues("doNothing", "add"),
"where": carapace.ActionValues("after", "before", "end", "start"),
})

carapace.Gen(interpretTrailerCmd).PositionalAnyCompletion(
carapace.ActionFiles(),
)
}
29 changes: 0 additions & 29 deletions completers/git_completer/cmd/interpret_trailers_generated.go

This file was deleted.

0 comments on commit f67da5f

Please sign in to comment.