Skip to content

Commit

Permalink
feat(golang-rewrite): update cmd code to use urfave/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Stratus3D committed Feb 22, 2024
1 parent a492bb0 commit ff040aa
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
package cmd

import (
"fmt"
"log"
"os"

"github.com/spf13/cobra"
"github.com/urfave/cli/v2"
)

var rootCmd = &cobra.Command{
Use: "asdf",
Short: "The multiple runtime version manager",
Long: `The Multiple Runtime Version Manager.
func Execute() {
app := &cli.App{
Name: "asdf",
Version: "0.1.0",
Usage: "The multiple runtime version manager",
UsageText: `The Multiple Runtime Version Manager.
Manage all your runtime versions with one tool!
Complete documentation is available at https://asdf-vm.com/`,
Run: func(cmd *cobra.Command, args []string) {
// TODO: Flesh this out
fmt.Println("Late but latest -- Rajinikanth")
},
}

func init() {
// TODO: Add flags relevant to all commands
//rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
Action: func(cCtx *cli.Context) error {
// TODO: flesh this out
log.Print("Late but latest -- Rajinikanth")
return nil
},
}

// TODO: Add sub commands
//rootCmd.AddCommand(pluginCmd)
}
err := app.Run(os.Args)

func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
if err != nil {
os.Exit(1)
log.Fatal(err)
}
}

0 comments on commit ff040aa

Please sign in to comment.