mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-19 09:55:01 -07:00
Merge pull request #25 from asdf-vm/tb/plugin-command-placeholders
feat(golang-rewrite): add placeholders for plugin subcommands
This commit is contained in:
commit
f9e25b06fb
90
cmd/main.go
90
cmd/main.go
@ -1,37 +1,83 @@
|
||||
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.
|
||||
const 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")
|
||||
|
||||
// TODO: Add sub commands
|
||||
//rootCmd.AddCommand(pluginCmd)
|
||||
}
|
||||
Complete documentation is available at https://asdf-vm.com/`
|
||||
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
app := &cli.App{
|
||||
Name: "asdf",
|
||||
Version: "0.1.0",
|
||||
// Not really sure what I should put here, but all the new Golang code will
|
||||
// likely be written by me.
|
||||
Copyright: "(c) 2024 Trevor Brown",
|
||||
Authors: []*cli.Author{
|
||||
&cli.Author{
|
||||
Name: "Trevor Brown",
|
||||
},
|
||||
},
|
||||
Usage: "The multiple runtime version manager",
|
||||
UsageText: usageText,
|
||||
Commands: []*cli.Command{
|
||||
// TODO: Flesh out all these commands
|
||||
&cli.Command{
|
||||
Name: "plugin",
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
log.Print("Foobar")
|
||||
return nil
|
||||
},
|
||||
Subcommands: []*cli.Command{
|
||||
&cli.Command{
|
||||
Name: "add",
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
log.Print("Baz")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
&cli.Command{
|
||||
Name: "list",
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
log.Print("Bim")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
&cli.Command{
|
||||
Name: "Lorem",
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
log.Print("Foobar")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
&cli.Command{
|
||||
Name: "update",
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
log.Print("Ipsum")
|
||||
return nil
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
// TODO: flesh this out
|
||||
log.Print("Late but latest -- Rajinikanth")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
err := app.Run(os.Args)
|
||||
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
7
go.mod
7
go.mod
@ -5,12 +5,13 @@ go 1.21.5
|
||||
require (
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/sethvargo/go-envconfig v1.0.0
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/urfave/cli/v2 v2.27.1
|
||||
gopkg.in/ini.v1 v1.67.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
)
|
||||
|
13
go.sum
13
go.sum
@ -1,24 +1,23 @@
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sethvargo/go-envconfig v1.0.0 h1:1C66wzy4QrROf5ew4KdVw942CQDa55qmlYmw9FZxZdU=
|
||||
github.com/sethvargo/go-envconfig v1.0.0/go.mod h1:Lzc75ghUn5ucmcRGIdGQ33DKJrcjk4kihFYgSTBmjIc=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
|
||||
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
Loading…
Reference in New Issue
Block a user