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

brew: renamed abv to info #2230

Merged
merged 1 commit into from
Feb 7, 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
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(),
)
}
Loading