github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/program/subprograms.go (about) 1 package program 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/u-root/u-root/cmds/core/elvish/build" 8 ) 9 10 // ShowHelp shows help message. 11 type ShowHelp struct { 12 flag *flagSet 13 } 14 15 func (s ShowHelp) Main([]string) int { 16 usage(os.Stdout, s.flag) 17 return 0 18 } 19 20 type ShowCorrectUsage struct { 21 message string 22 flag *flagSet 23 } 24 25 func (s ShowCorrectUsage) Main([]string) int { 26 usage(os.Stderr, s.flag) 27 return 2 28 } 29 30 // ShowVersion shows the version. 31 type ShowVersion struct{} 32 33 func (ShowVersion) Main([]string) int { 34 fmt.Println(build.Version) 35 fmt.Fprintln(os.Stderr, "-version is deprecated and will be removed in 0.12. Use -buildinfo instead.") 36 return 0 37 } 38 39 // ShowBuildInfo shows build information. 40 type ShowBuildInfo struct { 41 } 42 43 func (info ShowBuildInfo) Main([]string) int { 44 fmt.Println("version:", build.Version) 45 fmt.Println("builder:", build.Builder) 46 return 0 47 }