40 lines
732 B
Go
40 lines
732 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/alexflint/go-arg"
|
|
)
|
|
|
|
/*
|
|
this parses the command line arguements
|
|
|
|
this enables command line options from other packages like 'gui' and 'log'
|
|
*/
|
|
|
|
var argv args
|
|
|
|
type args struct {
|
|
Demo string `arg:"positional" help:"this is just a demo"`
|
|
}
|
|
|
|
func (a args) Description() string {
|
|
return `
|
|
This helloworld example demonstrates the 'gui' plugin toolkits
|
|
`
|
|
}
|
|
|
|
func init() {
|
|
pp := arg.MustParse(&argv)
|
|
|
|
// for very new users or users unfamilar with the command line, this may help them
|
|
if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" {
|
|
pp.WriteHelp(os.Stdout)
|
|
os.Exit(0)
|
|
}
|
|
}
|
|
|
|
func (args) Version() string {
|
|
return "helloworld " + VERSION
|
|
}
|