package main import ( "fmt" "strings" "go.wit.com/dev/alexflint/arg" "go.wit.com/lib/protobuf/argvpb" ) // sent from -ldflags var VERSION string var BUILDTIME string var APPNAME string = "go-deb" /* this parses the command line arguements this enables command line options from other packages like 'gui' and 'log' */ func (args) Examples() string { var out string out += "go-deb --dir ~/incoming/ --repo . # build a .deb of the current directory\n" return out } func (a args) Description() string { return ` Example usage: go-deb --repo go.wit.com/apps/go-clone this is a work in progress` } func (args) MustParse() error { me.pp = arg.MustParse(&argv) return nil } // sends the strings to bash or zsh that will be your options func (a args) DoAutoComplete() error { if argvpb.PB.GetCmd() == "" { matches := []string{"dump", "gui", "show", "--version", "--keep-files", "--buildversion"} fmt.Fprintf(argvpb.Stdout, " %s", strings.Join(matches, " ")) return nil } var err error if me.pp == nil { me.pp, err = arg.ParseFlagsArgv(&argv) if err != nil { return err } } err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...) return err }