Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: update-ref #2499

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.