summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go60
1 files changed, 30 insertions, 30 deletions
diff --git a/main.go b/main.go
index 237fdb7..d7ada82 100644
--- a/main.go
+++ b/main.go
@@ -1,42 +1,42 @@
package main
import (
- "fmt"
- "os"
- "context"
- "log"
- "github.com/fatih/color"
- "github.com/urfave/cli/v3"
+ "context"
+ "fmt"
+ "github.com/fatih/color"
+ "github.com/urfave/cli/v3"
+ "log"
+ "os"
)
func main() {
EnsureBrewAvailable()
- // declare CLI app
- cmd := &cli.Command{
- Name: "wthis",
- Usage: "Fetch information of a Homebrew formulae or cask, like how it got installed, reverse dependencies, etc.",
- Action: func(ctx context.Context, cmd *cli.Command) error {
- // check args
- if cmd.Args().Len() == 0 {
- printErrorAndExit("Please provide a formulae/cask name.")
- }
- pkgName := cmd.Args().First()
- // prompt
- showLoadingPrompt(fmt.Sprintf("What the heck is \"%s\"", pkgName))
- // search, tidy up, and print
- formula, cask := GetBrewInfo(pkgName)
- stat := NewStatistics(formula, cask, pkgName)
- hideLoadingPrompt()
- stat.Print()
- return nil
- },
- }
+ // declare CLI app
+ cmd := &cli.Command{
+ Name: "wthis",
+ Usage: "Fetch information of a Homebrew formulae or cask, like how it got installed, reverse dependencies, etc.",
+ Action: func(ctx context.Context, cmd *cli.Command) error {
+ // check args
+ if cmd.Args().Len() == 0 {
+ printErrorAndExit("Please provide a formulae/cask name.")
+ }
+ pkgName := cmd.Args().First()
+ // prompt
+ showLoadingPrompt(fmt.Sprintf("What the heck is \"%s\"", pkgName))
+ // search, tidy up, and print
+ formula, cask := GetBrewInfo(pkgName)
+ stat := NewStatistics(formula, cask, pkgName)
+ hideLoadingPrompt()
+ stat.Print()
+ return nil
+ },
+ }
- // run command and handle error
- if err := cmd.Run(context.Background(), os.Args); err != nil {
- log.Fatal(err)
- }
+ // run command and handle error
+ if err := cmd.Run(context.Background(), os.Args); err != nil {
+ log.Fatal(err)
+ }
}
func printErrorAndExit(msg string) {