From be6c0589c0768013bcf2c9c1be1e96a9d53ddfdf Mon Sep 17 00:00:00 2001 From: rsteube Date: Sat, 17 Aug 2024 21:52:21 +0200 Subject: [PATCH] git: refs --- completers/git_completer/cmd/refs.go | 19 ++++++++++++++ completers/git_completer/cmd/refs_migrate.go | 27 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 completers/git_completer/cmd/refs.go create mode 100644 completers/git_completer/cmd/refs_migrate.go diff --git a/completers/git_completer/cmd/refs.go b/completers/git_completer/cmd/refs.go new file mode 100644 index 0000000000..b494df6729 --- /dev/null +++ b/completers/git_completer/cmd/refs.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var refsCmd = &cobra.Command{ + Use: "refs", + Short: "Low-level access to refs", + Run: func(cmd *cobra.Command, args []string) {}, + GroupID: groups[group_manipulator].ID, +} + +func init() { + carapace.Gen(refsCmd).Standalone() + + rootCmd.AddCommand(refsCmd) +} diff --git a/completers/git_completer/cmd/refs_migrate.go b/completers/git_completer/cmd/refs_migrate.go new file mode 100644 index 0000000000..f4bdadf75d --- /dev/null +++ b/completers/git_completer/cmd/refs_migrate.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "github.com/carapace-sh/carapace" + "github.com/spf13/cobra" +) + +var refs_migrateCmd = &cobra.Command{ + Use: "migrate", + Short: "Migrate ref store between different formats", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(refs_migrateCmd).Standalone() + + refs_migrateCmd.Flags().Bool("dry-run", false, "perform the migration, but do not modify the repository") + refs_migrateCmd.Flags().String("ref-format", "", "the ref format to migrate the ref store to") + refsCmd.AddCommand(refs_migrateCmd) + + carapace.Gen(refs_migrateCmd).FlagCompletion(carapace.ActionMap{ + "ref-format": carapace.ActionValuesDescribed( + "files", "loose files with packed-refs", + "reftable", "reftable format", + ), + }) +}