From 992a3d505ff5176cc7102926cd3c96675c44da38 Mon Sep 17 00:00:00 2001 From: rsteube Date: Wed, 7 Feb 2024 23:33:09 +0100 Subject: [PATCH] brew: renamed abv to info - added alias --- completers/brew_completer/cmd/abv.go | 47 --------------------------- completers/brew_completer/cmd/info.go | 44 ++++++++++++++----------- 2 files changed, 25 insertions(+), 66 deletions(-) delete mode 100644 completers/brew_completer/cmd/abv.go diff --git a/completers/brew_completer/cmd/abv.go b/completers/brew_completer/cmd/abv.go deleted file mode 100644 index c0b6b92cc1..0000000000 --- a/completers/brew_completer/cmd/abv.go +++ /dev/null @@ -1,47 +0,0 @@ -package cmd - -import ( - "github.com/rsteube/carapace" - "github.com/rsteube/carapace-bin/pkg/actions/tools/brew" - "github.com/spf13/cobra" -) - -var abvCmd = &cobra.Command{ - Use: "abv", - Short: "Display brief statistics for your Homebrew installation", - Run: func(cmd *cobra.Command, args []string) {}, -} - -func init() { - carapace.Gen(abvCmd).Standalone() - - abvCmd.Flags().Bool("analytics", false, "List global Homebrew analytics data") - abvCmd.Flags().Bool("cask", false, "Treat all named arguments as casks") - abvCmd.Flags().String("category", "", "Which type of analytics data to retrieve") - abvCmd.Flags().String("days", "", "How many days of analytics data to retrieve") - abvCmd.Flags().Bool("debug", false, "Display any debugging information") - abvCmd.Flags().Bool("eval-all", false, "Evaluate all available formulae and casks") - abvCmd.Flags().Bool("formula", false, "Treat all named arguments as formulae") - abvCmd.Flags().Bool("github", false, "Open the GitHub source page for and in a browser") - abvCmd.Flags().Bool("help", false, "Show this message") - abvCmd.Flags().Bool("installed", false, "Print JSON of formulae that are currently installed") - abvCmd.Flags().Bool("json", false, "Print a JSON representation") - abvCmd.Flags().Bool("quiet", false, "Make some output more quiet") - abvCmd.Flags().Bool("variations", false, "Include the variations hash in each formula's JSON output") - abvCmd.Flags().Bool("verbose", false, "Show more verbose analytics data for ") - rootCmd.AddCommand(abvCmd) - - abvCmd.MarkFlagsMutuallyExclusive("cask", "formula") - - carapace.Gen(abvCmd).FlagCompletion(carapace.ActionMap{ - "category": carapace.ActionValues("install", "install-on-request", "build-error", "cask-install", "os-version"), - "days": carapace.ActionValues("30", "90", "365"), - }) - - carapace.Gen(abvCmd).PositionalAnyCompletion( - carapace.Batch( - brew.ActionAllCasks().Unless(func(c carapace.Context) bool { return abvCmd.Flag("formula").Changed }), - brew.ActionAllFormulae().Unless(func(c carapace.Context) bool { return abvCmd.Flag("cask").Changed }), - ).ToA(), - ) -} diff --git a/completers/brew_completer/cmd/info.go b/completers/brew_completer/cmd/info.go index 015cb04c3a..04799733a7 100644 --- a/completers/brew_completer/cmd/info.go +++ b/completers/brew_completer/cmd/info.go @@ -2,41 +2,47 @@ package cmd import ( "github.com/rsteube/carapace" - "github.com/rsteube/carapace-bin/completers/brew_completer/cmd/action" + "github.com/rsteube/carapace-bin/pkg/actions/tools/brew" "github.com/spf13/cobra" ) var infoCmd = &cobra.Command{ Use: "info", + Aliases: []string{"abv"}, Short: "Display brief statistics for your Homebrew installation", - GroupID: "main", Run: func(cmd *cobra.Command, args []string) {}, } func init() { carapace.Gen(infoCmd).Standalone() - infoCmd.Flags().Bool("analytics", false, "List global Homebrew analytics data or, if specified, installation and build error data for (provided neither `HOMEBREW_NO_ANALYTICS` nor `HOMEBREW_NO_GITHUB_API` are set).") - infoCmd.Flags().Bool("cask", false, "Treat all named arguments as casks.") - infoCmd.Flags().String("category", "", "Which type of analytics data to retrieve. The value for must be `install`, `install-on-request` or `build-error`; `cask-install` or `os-version` may be specified if is not. The default is `install`.") - infoCmd.Flags().Bool("days", false, "How many days of analytics data to retrieve. The value for must be `30`, `90` or `365`. The default is `30`.") - infoCmd.Flags().Bool("debug", false, "Display any debugging information.") - infoCmd.Flags().Bool("eval-all", false, "Evaluate all available formulae and casks, whether installed or not, to print their JSON. Implied if `HOMEBREW_EVAL_ALL` is set.") - infoCmd.Flags().Bool("formula", false, "Treat all named arguments as formulae.") - infoCmd.Flags().Bool("github", false, "Open the GitHub source page for and in a browser. To view the history locally: `brew log -p` or ") - infoCmd.Flags().Bool("help", false, "Show this message.") - infoCmd.Flags().Bool("installed", false, "Print JSON of formulae that are currently installed.") - infoCmd.Flags().Bool("json", false, "Print a JSON representation. Currently the default value for is `v1` for . For and use `v2`. See the docs for examples of using the JSON output: ") - infoCmd.Flags().Bool("quiet", false, "Make some output more quiet.") - infoCmd.Flags().Bool("variations", false, "Include the variations hash in each formula's JSON output.") - infoCmd.Flags().Bool("verbose", false, "Show more verbose analytics data for .") + infoCmd.Flags().Bool("analytics", false, "List global Homebrew analytics data") + infoCmd.Flags().Bool("cask", false, "Treat all named arguments as casks") + infoCmd.Flags().String("category", "", "Which type of analytics data to retrieve") + infoCmd.Flags().String("days", "", "How many days of analytics data to retrieve") + infoCmd.Flags().Bool("debug", false, "Display any debugging information") + infoCmd.Flags().Bool("eval-all", false, "Evaluate all available formulae and casks") + infoCmd.Flags().Bool("formula", false, "Treat all named arguments as formulae") + infoCmd.Flags().Bool("github", false, "Open the GitHub source page for and in a browser") + infoCmd.Flags().Bool("help", false, "Show this message") + infoCmd.Flags().Bool("installed", false, "Print JSON of formulae that are currently installed") + infoCmd.Flags().Bool("json", false, "Print a JSON representation") + infoCmd.Flags().Bool("quiet", false, "Make some output more quiet") + infoCmd.Flags().Bool("variations", false, "Include the variations hash in each formula's JSON output") + infoCmd.Flags().Bool("verbose", false, "Show more verbose analytics data for ") rootCmd.AddCommand(infoCmd) + infoCmd.MarkFlagsMutuallyExclusive("cask", "formula") + carapace.Gen(infoCmd).FlagCompletion(carapace.ActionMap{ - "category": carapace.ActionValues("install", "install-on-request", "build-error"), + "category": carapace.ActionValues("install", "install-on-request", "build-error", "cask-install", "os-version"), + "days": carapace.ActionValues("30", "90", "365"), }) - carapace.Gen(installCmd).PositionalAnyCompletion( - action.ActionSearch(installCmd), + carapace.Gen(infoCmd).PositionalAnyCompletion( + carapace.Batch( + brew.ActionAllCasks().Unless(func(c carapace.Context) bool { return infoCmd.Flag("formula").Changed }), + brew.ActionAllFormulae().Unless(func(c carapace.Context) bool { return infoCmd.Flag("cask").Changed }), + ).ToA().FilterArgs(), ) }