package prep // initializes logging and command line options import ( "strings" "go.wit.com/dev/alexflint/arg" ) /* This struct can be used with the go-arg package. These are the generic default command line arguments for the 'GUI' package */ var argBash ArgsBash type ArgsBash struct { Bash bool `arg:"--bash" help:"generate bash completion"` } // try this struct out (?) var myAuto *AutoArgs // this is a work in progress type AutoArgs struct { id int // should be unique hidden bool // don't update the toolkits when it's hidden Auto func([]string) // the function for shell autocomplete appName string // a good way to track the name of the binary ? examples func() string // some examples appExit func() // app Exit() buildtime func() (string, string) // some examples pp *arg.Parser // for parsing the command line args. Yay to alexf lint! autoFunc func(*Auto) // also a function for autocomplete } // returns the last command (is blank if the current arg is not blank) func GetLast(cur string, argv []string) string { if cur != "''" { return "" } for _, s := range argv { if strings.HasPrefix(s, "-") { continue } return s } return "" } // returns the name of the executable registered for shell autocomplete func AppName() string { return myAuto.appName }