github.com/wawandco/ox@v0.13.6-0.20230809142027-913b3d837f2a/plugins/base/version/version.go (about) 1 package version 2 3 import ( 4 "context" 5 "fmt" 6 "os" 7 8 "github.com/wawandco/ox/internal/runtime" 9 "github.com/wawandco/ox/plugins/base/content" 10 "github.com/wawandco/ox/plugins/core" 11 ) 12 13 var ( 14 // Version is a Command 15 _ core.Command = (*Command)(nil) 16 ) 17 18 // Command command will print X version. 19 type Command struct{} 20 21 func (b Command) Name() string { 22 return "version" 23 } 24 25 func (c Command) Alias() string { 26 return "v" 27 } 28 29 func (b Command) ParentName() string { 30 return "" 31 } 32 33 func (b Command) HelpText() string { 34 return "returns the current version of ox CLI" 35 } 36 37 // Run prints the version of the ox cli 38 func (b *Command) Run(ctx context.Context, root string, args []string) error { 39 fmt.Println(content.Banner) 40 fmt.Printf("Version %v\n", runtime.Version) 41 42 return nil 43 } 44 45 func (b *Command) FindRoot() string { 46 wd, err := os.Getwd() 47 if err != nil { 48 return "" 49 } 50 51 return wd 52 }