package argvpb // 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"` } // returns the name of the executable registered for shell autocomplete func AppName() string { return me.ARGNAME } // try this struct out (?) var me *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 Argv func([]string) // the function for shell autocomplete 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(*Argv) // also a function for autocomplete guiFunc func() error // enables Gui functions err error // store any errors from argv pb *Argv ARGNAME string // a good way to track the name of the binary ? VERSION string BUILDTIME string } // 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 "" }