Skip to content

Commit

Permalink
brew: renamed abv to info
Browse files Browse the repository at this point in the history
- added alias
  • Loading branch information
rsteube committed Feb 7, 2024
1 parent dcfc034 commit 992a3d5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 66 deletions.
47 changes: 0 additions & 47 deletions completers/brew_completer/cmd/abv.go

This file was deleted.

44 changes: 25 additions & 19 deletions completers/brew_completer/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <formula> (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 <category> must be `install`, `install-on-request` or `build-error`; `cask-install` or `os-version` may be specified if <formula> is not. The default is `install`.")
infoCmd.Flags().Bool("days", false, "How many days of analytics data to retrieve. The value for <days> 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 <formula> and <cask> in a browser. To view the history locally: `brew log -p` <formula> or <cask>")
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 <version> is `v1` for <formula>. For <formula> and <cask> use `v2`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>")
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 <formula>.")
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 <formula> and <cask> 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 <formula>")
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(),
)
}

0 comments on commit 992a3d5

Please sign in to comment.