Skip to content

Commit

Permalink
git: update-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Aug 17, 2024
1 parent dedc12d commit 25f5700
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
39 changes: 39 additions & 0 deletions completers/git_completer/cmd/updateRef.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)

var updateRefCmd = &cobra.Command{
Use: "update-ref",
Short: "Update the object name stored in a ref safely",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_low_level_manipulator].ID,
}

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

updateRefCmd.Flags().Bool("create-reflog", false, "create a reflog")
updateRefCmd.Flags().BoolS("d", "d", false, "delete the reference")
updateRefCmd.Flags().Bool("deref", false, "opposite of --no-deref")
updateRefCmd.Flags().StringS("m", "m", "", "reason of the update")
updateRefCmd.Flags().Bool("no-create-reflog", false, "do not create a reflog")
updateRefCmd.Flags().Bool("no-deref", false, "update <refname> not the one it points to")
updateRefCmd.Flags().Bool("no-stdin", false, "do not read updates from stdin")
updateRefCmd.Flags().Bool("stdin", false, "read updates from stdin")
updateRefCmd.Flags().BoolS("z", "z", false, "stdin has NUL-terminated arguments")
rootCmd.AddCommand(updateRefCmd)

carapace.Gen(updateRefCmd).PositionalCompletion(

carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if updateRefCmd.Flag("stdin").Changed {
return carapace.ActionValues()
}
return git.ActionRefs(git.RefOption{}.Default())
}),
)
}
24 changes: 0 additions & 24 deletions completers/git_completer/cmd/update_ref_generated.go

This file was deleted.

0 comments on commit 25f5700

Please sign in to comment.