diff options
| author | Jeff Carr <[email protected]> | 2025-10-24 10:30:09 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-24 10:30:09 -0500 |
| commit | 2b46985ae8def4ff5779fbc027a6ddbe7a1a6a8d (patch) | |
| tree | c38a46169ddfd57a3f4619012e63d76f63980a81 | |
| parent | 41cf7c3c4ca2fbfca7f9c2328e6f4e0ac34661d9 (diff) | |
still kinda works. newer argv.proto
| -rw-r--r-- | argv.Print.go | 26 | ||||
| -rw-r--r-- | argv.SendStrings.go | 25 | ||||
| -rw-r--r-- | argv.parseOsArgs.go | 107 | ||||
| -rw-r--r-- | argv.proto | 25 | ||||
| -rw-r--r-- | argv.proto.next | 35 | ||||
| -rw-r--r-- | exit.go | 16 | ||||
| -rw-r--r-- | init.go | 1 | ||||
| -rw-r--r-- | notsure.go | 2 | ||||
| -rw-r--r-- | structs.go | 5 | ||||
| -rw-r--r-- | theMagicOfAutocomplete.go | 39 | ||||
| -rw-r--r-- | verifyApplication.go | 78 |
11 files changed, 160 insertions, 199 deletions
diff --git a/argv.Print.go b/argv.Print.go index 68e79d1..9429a01 100644 --- a/argv.Print.go +++ b/argv.Print.go @@ -5,7 +5,6 @@ package argvpb import ( "fmt" - "os" "strings" "go.wit.com/lib/cobol" @@ -15,17 +14,7 @@ import ( func (pb *Argv) Debugf(fmts string, parts ...any) { fmts = strings.TrimSpace(fmts) fmts += "\n" - // NOTE: env doesn't work probably most (all?) the time because bash - // doesn't send all the ENV to autocomplete. so, trap on a "--autodebug" command line arg - if os.Getenv("AUTOCOMPLETE_VERBOSE") == "true" || pb.Debug { - if !pb.Newline { - fmt.Fprintf(os.Stderr, "\n") - pb.Newline = true - } - fmt.Fprintf(os.Stderr, fmts, parts...) - } else { - // fmt.Fprintf(os.Stderr, "NOT DOING ANYTHING\n") - } + pb.Stderr += fmt.Sprintf(fmts, parts...) } // print out auto complete debugging info @@ -34,15 +23,20 @@ func (pb *Argv) PrintDebug() { } func (pb *Argv) PrintDebugNew(msg string) { - cmd := fmt.Sprintf("cmd='%s'", pb.Cmd) - arglast := fmt.Sprintf("last='%s'", pb.Last) + cmd := fmt.Sprintf("cmd='%s'", pb.GetCmd()) + var arglast string + if me.last == nil { + arglast = fmt.Sprintf("last='%s'", "<nil>") + } else { + arglast = fmt.Sprintf("last='%s'", me.last.GetCmd()) + } partial := fmt.Sprintf("p='%s'", pb.Partial) dur := cobol.Duration(pb.Ctime) var fast string if pb.Fast { - fast = "fast=1," + pb.Fastcmd + fast = "fast=1," + pb.GetCmd() } else { - fast = "fast=0," + pb.Fastcmd + fast = "fast=0," + pb.GetCmd() } sargv := fmt.Sprintf("argv(%v)", pb.Real) pb.Debugf("%s: age=(%s) %-12.12s %-12.12s %-12.12s %s %s goargs='%v'", msg, dur, cmd, arglast, partial, fast, sargv, pb.Goargs) diff --git a/argv.SendStrings.go b/argv.SendStrings.go index 0351286..4192ba0 100644 --- a/argv.SendStrings.go +++ b/argv.SendStrings.go @@ -42,23 +42,17 @@ func (pb *Argv) GenerateSubCommandStrings(cmd ...string) { } func (pb *Argv) SubCommand(cmd ...string) { - if pb.Debug { - if me.examples == nil { - pb.Debugf("WRITE DEBUG: argv.Examples() not defined") - // log.Fprintf(os.Stderr, "\n") - // log.Fprintf(os.Stderr, "examples was nil\n") - // log.Fprintf(os.Stderr, "\n") - } else { - log.Fprintf(os.Stderr, "\n") - log.Fprintf(os.Stderr, "\n") - log.Fprintf(os.Stderr, "Examples:\n") - for _, line := range strings.Split(me.examples(), "\n") { - log.Fprintf(os.Stderr, " %s\n", line) - } - // log.Fprintf(os.Stderr, "\n") + if me.examples == nil { + pb.Debugf("WRITE DEBUG: argv.Examples() not defined") + } else { + pb.Stderr += log.Sprintf("Examples:\n") + for _, line := range strings.Split(me.examples(), "\n") { + pb.Stderr += log.Sprintf(" %s\n", line) } + } + partial := strings.Trim(pb.Partial, "'") + if me.debug { // last working line: me.writeHelpForAutocomplete(os.Stderr, os.Stdout, partial, cmd...) - partial := strings.Trim(pb.Partial, "'") me.writeHelpForAutocompleteDebugFunc(partial, cmd...) // me.pp.GetUsageForSubcommand(os.Stdout, os.Stderr, partial, cmd) @@ -66,7 +60,6 @@ func (pb *Argv) SubCommand(cmd ...string) { } else { // last working: f, _ := os.OpenFile("/tmp/outlook", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) // last working: me.writeHelpForAutocomplete(f, os.Stdout, partial, cmd...) - partial := strings.Trim(pb.Partial, "'") me.writeHelpForAutocompleteFunc(partial, cmd...) } os.Exit(0) diff --git a/argv.parseOsArgs.go b/argv.parseOsArgs.go index 70231ef..ac5be15 100644 --- a/argv.parseOsArgs.go +++ b/argv.parseOsArgs.go @@ -10,6 +10,42 @@ import ( "go.wit.com/log" ) +// todo: this is wrong +func (pb *Argv) GetCmd() string { + var curcmd string + for _, s := range os.Args[1:] { + if strings.HasPrefix(s, "-") { + // option is something like --verbose + // skip these. they are not subcommands + continue + } + // found the subcommand + curcmd = s + break + } + if pb.Partial == "'"+curcmd+"'" { + // not really a command, it's just a partially inputed string from the user + return "" + } + return curcmd +} + +// todo: this is dumb +func (pb *Argv) getSubSubCmd() string { + var subcmd string + for _, s := range pb.Real { + p := fmt.Sprintf("'%s'", s) + if pb.Partial == p { + pb.Debugf("DEBUG: Last argv MATCHES Partial %s %s", s, p) + continue + } else { + pb.Debugf("DEBUG: Last argv DOES NOT MATCH Partial %s %s", s, p) + } + subcmd = s + } + return subcmd +} + func (pb *Argv) parseOsArgs() { // this shouldn't really happen. OS/POSIX error? if len(os.Args) == 0 { @@ -19,45 +55,45 @@ func (pb *Argv) parseOsArgs() { // there is nothing on the command line. user just ran "forge" and hit enter if len(os.Args) == 1 { - pb.Arg0 = os.Args[0] + // pb.Arg0 = os.Args[0] return } // try to setup bash autocomplete and exit if len(os.Args) > 1 && os.Args[1] == "--bash" { - pb.SetupAuto = true + me.setupAuto = true return } // try to setup zsh autocomplete and exit if len(os.Args) > 1 && os.Args[1] == "--zsh" { - pb.SetupAuto = true + me.setupAuto = true return } // set debug flag if --argvdebug is passed for _, s := range os.Args { if s == "--argvdebug" { - pb.Debug = true + me.debug = true } // deprecate if s == "--autodebug" { - pb.Debug = true + me.debug = true } } // wtf is this. I've forgotten. todo: figure this out - if len(os.Args) > 1 && os.Args[1] == pb.Argname { - pb.IsAuto = true + if len(os.Args) > 1 && os.Args[1] == pb.AppInfo.APPNAME { + me.isAuto = true parts := strings.Split(os.Getenv("COMP_LINE"), " ") - pb.Debug = true + me.debug = true log.Fprintf(os.Stderr, "\n") pb.Debugf("MATCH Partial os.Args=%v COMP_LINE=%v", os.Args, os.Getenv("COMP_LINE")) // log.Fprintf(os.Stdout, "jcarr") if len(parts) > 0 { - pb.Arg0 = parts[0] + // pb.Arg0 = parts[0] } - pb.Arg1 = os.Args[1] + // pb.Arg1 = os.Args[1] os.Exit(0) } @@ -73,16 +109,8 @@ func (pb *Argv) parseOsArgs() { for _, s := range os.Args[1:] { pb.Real = append(pb.Real, s) } - for _, s := range os.Args[1:] { - if strings.HasPrefix(s, "-") { - // option is something like --verbose - // skip these. they are not subcommands - continue - } - // found the subcommand - pb.Cmd = s - break - } + // found the subcommand + // pb.Cmd = pb.findCmd() // exit here. not autocomplete // todo: actually finish parsing the pb. is it safe to continue from here? return @@ -91,17 +119,16 @@ func (pb *Argv) parseOsArgs() { // the shell is trying to get autocomplete information // initial PB setup - pb.IsAuto = true - pb.Arg0 = os.Args[0] - pb.Arg1 = os.Args[1] + me.isAuto = true + // pb.Arg0 = os.Args[0] + // pb.Arg1 = os.Args[1] pb.Partial = os.Args[2] - pb.Arg3 = os.Args[3] + // pb.Arg3 = os.Args[3] if len(os.Args) < 5 { // the user is doing autocomplete on the command itself // no subcommand. user has done "forge <TAB><TAB>" pb.Partial = "" - pb.Cmd = "" pb.Real = []string{""} return } @@ -123,36 +150,10 @@ func (pb *Argv) parseOsArgs() { } pb.Real = append(pb.Real, s) } - // set pb.Cmd to the first thing that doesn't have a '-' arg - for _, s := range pb.Real { - if strings.HasPrefix(s, "-") { - continue - } - pb.Cmd = s - break - } - if pb.Partial == "'"+pb.Cmd+"'" { - // not really a command, it's just a partially inputed string from the user - pb.Cmd = "" - } - // try to figure out what the last argv is + + // this is dumb for _, s := range pb.Real { - p := fmt.Sprintf("'%s'", s) - if pb.Partial == p { - pb.Debugf("DEBUG: Last argv MATCHES Partial %s %s", s, p) - continue - } else { - pb.Debugf("DEBUG: Last argv DOES NOT MATCH Partial %s %s", s, p) - } - pb.Last = s - if strings.HasPrefix(s, "-") { - // skip args like -test --verbose when sending subcommands to go-args for help text - continue - } pb.Goargs = append(pb.Goargs, s) } - // if pb.Cmd == "" { - // pb.Cmd = strings.Join(pb.Argv, "BLAH") - // } return } @@ -16,22 +16,15 @@ message App { message Argv { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex` google.protobuf.Timestamp ctime = 1; // when the user tried this autocomplete google.protobuf.Duration duration = 2; // time since the last autocomplete - string argname = 3; // what the shell thinks the name of the executable is - string arg0 = 4; // what os.Exec() has as os.Argv[0] // not interesting - string arg1 = 5; // should always be "--auto-complete" // not interesting - string arg3 = 6; // usually argv3 == argv0 - repeated string real = 7; // what is really sent to the application - string cmd = 8; // the cmd being processed. For "git pull <tab>", cmd would be "pull" - string partial = 9; // set to the partial string trying to be matched - bool isAuto = 10; // is true if '--auto-complete' is set - bool setupAuto = 11; // is true if '--bash' is set // setup bash autocomplete here - bool debug = 12; // print debugging info if true - bool newline = 13; // was a newline was sent to STDERR? - string last = 14; // the last arg - repeated string goargs = 15; // what to send to alex flint's go-args for help - bool fast = 16; // was the user fast last time? - string fastcmd = 17; // what subcommand was the user fast on? - App appInfo = 18; + App appInfo = 3; + repeated string args = 4; // a copy of os.Args + repeated string real = 5; // what will really be sent to the application + string subcmd = 6; // the subcommand being processed. For "git pull <tab>", cmd would be "pull" + string partial = 7; // if the user has only partially inputed something + repeated string goargs = 8; // what to send to alex flint's go-args for help + bool fast = 9; // is autocomplete running quickly? + string stdout = 10; // all output is loaded here before being sent to the shell + string stderr = 11; // all output is loaded here before being sent to the shell } message Argvs { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex` diff --git a/argv.proto.next b/argv.proto.next deleted file mode 100644 index 734a13e..0000000 --- a/argv.proto.next +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 - -syntax = "proto3"; - -package argvpb; - -import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp -import "google/protobuf/duration.proto"; // for duration - -message App { - string APPNAME = 1; - string VERSION = 2; - string BUILDTIME = 3; -} - -message Argv { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex` - google.protobuf.Timestamp ctime = 1; // when the user tried this autocomplete - google.protobuf.Duration duration = 2; // time since the last autocomplete - App appInfo = 18; - repeated string args = 7; // a copy of os.Args - repeated string real = 7; // what will really be sent to the application - string subcmd = 8; // the subcommand being processed. For "git pull <tab>", cmd would be "pull" - string partial = 9; // if the user has only partially inputed something - repeated string goargs = 15; // what to send to alex flint's go-args for help - bool fast = 16; // is autocomplete running quickly? - string stdout = 19; // all output is loaded here before being sent to the shell - string stderr = 10; // all output is loaded here before being sent to the shell -} - -message Argvs { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:nomutex` - string uuid = 1; // `autogenpb:uuid:1e6e765c-0c77-4c81-a622-0d819bfcce9a` - string version = 2; // `autogenpb:version:v0.0.3` - repeated Argv argvs = 3; - string filename = 4; // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save() -} @@ -29,7 +29,13 @@ func (pb *Argv) GoodExit(msg string) { me.appExit() } dur := time.Since(pb.Ctime.AsTime()) - log.Infof("%s: %s (%s)\n", pb.Argname, msg, cobol.FormatDuration(dur)) + var appname string + if pb.AppInfo == nil { + appname = os.Args[0] + } else { + appname = pb.AppInfo.APPNAME + } + log.Infof("%s: %s (%s)\n", appname, msg, cobol.FormatDuration(dur)) os.Exit(0) } @@ -53,7 +59,13 @@ func (pb *Argv) BadExit(msg string, err error) { } dur := time.Since(pb.Ctime.AsTime()) - log.Infof("%s error: %s (%s)\n", pb.Argname, msg, cobol.FormatDuration(dur)) + var appname string + if pb.AppInfo == nil { + appname = os.Args[0] + } else { + appname = pb.AppInfo.APPNAME + } + log.Infof("%s error: %s (%s)\n", appname, msg, cobol.FormatDuration(dur)) os.Exit(1) } @@ -32,5 +32,4 @@ func initAppname() { log.Printf("TIME initAppname() ERR=(%v) anyString=(%v) GetTime.BUILTIME=(%v) app.BUILDTIME=(%v)\n", err, anyString, BUILDTIME, app.BUILDTIME) } me.pb.AppInfo = app - me.pb.Argname = APPNAME // deprecate this } @@ -18,7 +18,7 @@ type ArgsBash struct { func (pb *Argv) Gui() bool { log.Printf("CUR pb: %v\n", pb) log.Info("CUR ARGV:", pb.Real) - if pb.Cmd == "gui" { + if "gui" == pb.GetCmd() { return true } return false @@ -6,6 +6,7 @@ var me *AutoArgs // this is a work in progress type AutoArgs struct { pb *Argv // the protobuf for the current process + last *Argv // the pb from the last time the user tried autocomplete id int // should be unique Argv func([]string) // the function for shell autocomplete initArgvFunc func() (string, string, string) // this is required. gets APPNAME, BUILDTIME & VERSION @@ -22,4 +23,8 @@ type AutoArgs struct { autoFunc func(*Argv) // also a function for autocomplete guiFunc func() error // enables Gui functions err error // store any errors from argv + debug bool // is dubugging on? + setupAuto bool // do shell autocomplete setup + isAuto bool // try to do autocomplete + } diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index 3f2311f..94fb38c 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -63,7 +63,7 @@ func Autocomplete(dest any) *Argv { // user is trying to setup bash or zsh autocomplete // --bash or --zsh is the first os.Args - if me.pb.SetupAuto { + if me.setupAuto { // --bash or --zsh was passed. try to configure bash-completion MakeAutocompleteFiles(me.pb.AppInfo.APPNAME) // never forget to run this our you will hate yourself and the choices you have made @@ -78,7 +78,7 @@ func Autocomplete(dest any) *Argv { } // not autocompleting. return go-arg & the application - if !me.pb.IsAuto { + if !me.isAuto { // save the pb & history all.Clone(me.pb) errors.Join(err, all.Save()) @@ -93,15 +93,15 @@ func Autocomplete(dest any) *Argv { // set the duration since the last auto complete // find the last entry. this is dumb way to do it - last := new(Argv) - last.Ctime = timestamppb.New(time.Now().Add(-time.Second)) + me.last = new(Argv) + me.last.Ctime = timestamppb.New(time.Now().Add(-time.Second)) for found := range all.IterAll() { - last = found + me.last = found } - dur := time.Since(last.Ctime.AsTime()) + dur := time.Since(me.last.Ctime.AsTime()) me.pb.Duration = durationpb.New(dur) - if me.pb.Debug { + if me.debug { // dump debug info me.pb.PrintDebug() all.PrintHistory() @@ -120,11 +120,11 @@ func Autocomplete(dest any) *Argv { // turn on debugging if duration < 200 milliseconds dur = me.pb.Duration.AsDuration() if dur < time.Millisecond*200 { - me.pb.Debug = true + me.debug = true me.pb.Fast = true - me.pb.Fastcmd = me.pb.Cmd - if last.Fast { - if me.pb.Fastcmd == last.Fastcmd { + // me.fastcmd = me.pb.GetCmd() + if me.last.Fast { + if me.pb.GetCmd() == me.last.GetCmd() { // do the smart something here } } @@ -142,7 +142,7 @@ func Autocomplete(dest any) *Argv { flags = append(flags, s) } - if strings.HasPrefix(me.pb.Last, "--argv") { + if strings.HasPrefix(me.pb.Partial, "--argv") { me.pb.SendString("--argvdebug --argvhelp") os.Exit(0) } @@ -171,26 +171,27 @@ func Autocomplete(dest any) *Argv { all.Clone(me.pb) errors.Join(err, all.Save()) + lastarg := me.pb.Real[len(me.pb.Real)-1] // this is a work in progress - if me.pb.Last == "--gui" { - me.pb.Debugf("DEBUG: last=%s found --gui", me.pb.Last) + if lastarg == "--gui" { + me.pb.Debugf("DEBUG: real=(%v) found --gui", me.pb.Real) me.pb.SendString("andlabs gogui") os.Exit(0) } else { - // me.pb.Debugf("DEBUG: NO MATCH last='%s' found key '%s' = %s", me.pb.Last, key, val) + // me.pb.Debugf("DEBUG: NO MATCH last='%s' found key '%s' = %s", me.last, key, val) } if me.pb.Fast { - if last.Fast { + if me.last.Fast { os.Exit(0) } else { // this means the user is pressing tab. no longer doing stderr - if me.pb.Cmd == "" { + if me.pb.GetCmd() == "" { // me.pp.WriteHelp(os.Stderr) me.writeHelpFunc() } else { // me.pp.WriteHelpForSubcommand(os.Stderr, me.pb.Cmd) - me.writeHelpForSubcommandFunc(me.pb.Cmd) + me.writeHelpForSubcommandFunc(me.pb.GetCmd()) } } } else { @@ -201,7 +202,7 @@ func Autocomplete(dest any) *Argv { } else { me.autoFunc(me.pb) // run the autocomplete function the user made for their application } - if me.pb.Debug { + if me.debug { // TODO: // check here to see if there was any completion text sent // if not, send "reset bash newline\n" to cause bash to redraw PS1 for the user diff --git a/verifyApplication.go b/verifyApplication.go index f228dcd..9eaed32 100644 --- a/verifyApplication.go +++ b/verifyApplication.go @@ -1,8 +1,6 @@ package argvpb -import ( - "go.wit.com/log" -) +import "fmt" // verify the application has the needed function calls defined func verifyApplication(tmp interface{}) { @@ -52,7 +50,7 @@ func verifyApplication(tmp interface{}) { if tmp, ok := tmp.(initGuiI); ok { me.initGuiFunc = tmp.InitGui if err := tmp.InitGui(); err != nil { - log.Info("go.wit.com/gui failed to initialize", err) + fmt.Println("go.wit.com/gui failed to initialize", err) panic("gui failed to init") } } else { @@ -163,37 +161,37 @@ type exitI interface { } func helpWriteHelpForSubcommand() { - log.Info("") - log.Info("// add this funcgion: this will print the help") - log.Info("func (args) WriteHelpForSubcommand() error {") - log.Info(" me.pp.WriteHelpForSubcommand(os.Stderr, me.argv.Cmd)") - log.Info(" return nil") - log.Info("}") - log.Info("") - log.Info("cp ~/go/src/go.wit.com/apps/forge/argv.template.go .") + fmt.Println("") + fmt.Println("// add this funcgion: this will print the help") + fmt.Println("func (args) WriteHelpForSubcommand() error {") + fmt.Println(" me.pp.WriteHelpForSubcommand(os.Stderr, me.argv.Cmd)") + fmt.Println(" return nil") + fmt.Println("}") + fmt.Println("") + fmt.Println("cp ~/go/src/go.wit.com/apps/forge/argv.template.go .") panic("copy the argv.template.go file from forge") } func helpWriteHelp() { - log.Info("") - log.Info("// add this funcgion: this will print the help") - log.Info("func (args) WriteHelp() error {") - log.Info(" me.pp.WriteHelp(os.Stderr)") - log.Info(" return nil") - log.Info("}") - log.Info("") + fmt.Println("") + fmt.Println("// add this funcgion: this will print the help") + fmt.Println("func (args) WriteHelp() error {") + fmt.Println(" me.pp.WriteHelp(os.Stderr)") + fmt.Println(" return nil") + fmt.Println("}") + fmt.Println("") panic("best to just copy the argv.template.go file from forge") } func helpWriteHelpForAutocompleteDebug() { - log.Info("") - log.Info("// this will print the help for the subcmd") - log.Info("func (args) WriteHelpForAutocompleteDebug(part string, subcmd ...string) error {") - log.Info(" return argvpp.WriteHelpForAutocomplete(f, os.Stdout, part, subcmd...)") - log.Info("}") - log.Info("") - log.Info("cp ~/go/src/go.wit.com/apps/forge/argv.template.go .") + fmt.Println("") + fmt.Println("// this will print the help for the subcmd") + fmt.Println("func (args) WriteHelpForAutocompleteDebug(part string, subcmd ...string) error {") + fmt.Println(" return argvpp.WriteHelpForAutocomplete(f, os.Stdout, part, subcmd...)") + fmt.Println("}") + fmt.Println("") + fmt.Println("cp ~/go/src/go.wit.com/apps/forge/argv.template.go .") panic("best to just copy the argv.template.go file from forge") } @@ -201,25 +199,25 @@ func helpWriteHelpForAutocompleteDebug() { // func (p *Parser) WriteHelpForAutocomplete(stderr io.Writer, stdout io.Writer, partial string, subcommand ...string) error { // me.pp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, partial, cmd...) func helpWriteHelpForAutocomplete() { - log.Info("") - log.Info("// this will print the help for the subcmd") - log.Info("func (args) WriteHelpForAutocomplete(part string, subcmd ...string) error {") - log.Info(" return argvpp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, part, subcmd...)") - log.Info("}") - log.Info("") - log.Info("Just copy the argv.template.go file from forge") - log.Info("") + fmt.Println("") + fmt.Println("// this will print the help for the subcmd") + fmt.Println("func (args) WriteHelpForAutocomplete(part string, subcmd ...string) error {") + fmt.Println(" return argvpp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, part, subcmd...)") + fmt.Println("}") + fmt.Println("") + fmt.Println("Just copy the argv.template.go file from forge") + fmt.Println("") panic("you must define this function in your application code") } func parseFlagsHelp() { - log.Info("") - log.Info("// this function will send the current argv PB to go-args for parsing") - log.Info("func (args) ParseFlags(flags []string) error {") - log.Info(" arg.ParseFlags(flags)") - log.Info("}") - log.Info("") + fmt.Println("") + fmt.Println("// this function will send the current argv PB to go-args for parsing") + fmt.Println("func (args) ParseFlags(flags []string) error {") + fmt.Println(" arg.ParseFlags(flags)") + fmt.Println("}") + fmt.Println("") panic("you must define in your app the function: func (args) ParseFlags([]string) error") } |
