-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(golang-rewrite): update cmd code to use urfave/cli
- Loading branch information
Showing
1 changed file
with
17 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |