diff options
| -rw-r--r-- | argv.SendStrings.go | 62 | ||||
| -rw-r--r-- | dryrun.go | 7 | ||||
| -rw-r--r-- | notsure.go | 4 | ||||
| -rw-r--r-- | theMagicOfAutocomplete.go | 20 |
4 files changed, 10 insertions, 83 deletions
diff --git a/argv.SendStrings.go b/argv.SendStrings.go deleted file mode 100644 index 4467d06..0000000 --- a/argv.SendStrings.go +++ /dev/null @@ -1,62 +0,0 @@ -package argvpb - -// sends the autocomplete strings to the shell -// also where custom strings are pulled in from the application -// calls into go-args for strings parsed by MustParse() - -import ( - "fmt" - "os" - "strings" -) - -// the application must send a string "help run list" -func (pb *Argv) SendString(sendthis string) { - pb.SendStrings(strings.Split(sendthis, " ")) -} - -// the application must send an array []string{"help", "run", "list"} -func (pb *Argv) SendStrings(parts []string) { - // parts := strings.Split(sendthis, " ") - var all []string - for _, part := range parts { - var found bool - for _, s := range os.Args { - if s == part { - found = true - } - } - if found { - continue - } - all = append(all, part) - } - pb.Stdout = fmt.Sprintf("%s", strings.Join(all, " ")) -} - -// try out a new name. also, this whole thing is dumb and needs to be redone -func (pb *Argv) GenerateSubCommandStrings(cmd ...string) { - pb.SubCommand(cmd...) -} - -func (pb *Argv) SubCommand(cmd ...string) { - if me.examples == nil { - pb.Debugf("WRITE DEBUG: argv.Examples() not defined") - } else { - pb.Stderr += fmt.Sprintf("Examples:\n") - for _, line := range strings.Split(me.examples(), "\n") { - pb.Stderr += fmt.Sprintf(" %s\n", line) - } - } - if me.debug { - // last working line: me.writeHelpForAutocomplete(Stderr, Stdout, partial, cmd...) - me.writeHelpForAutocompleteDebugFunc() - - // me.pp.GetUsageForSubcommand(Stdout, Stderr, partial, cmd) - // me.pp.GetUsageForSubcommand(Stdout, nil, partial, cmd) - } else { - // last working: me.writeHelpForAutocomplete(f, Stdout, partial, cmd...) - me.writeHelpForAutocompleteFunc() - } - os.Exit(0) -} diff --git a/dryrun.go b/dryrun.go deleted file mode 100644 index b9f4447..0000000 --- a/dryrun.go +++ /dev/null @@ -1,7 +0,0 @@ -package argvpb - -// think about using something like this - -func DryRun() bool { - return false -} @@ -23,7 +23,3 @@ func (pb *Argv) Gui() bool { } return false } - -func (pb *Argv) Dump() { - fmt.Printf("CUR pb: %v\n", pb) -} diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go index 29008bf..f1d427d 100644 --- a/theMagicOfAutocomplete.go +++ b/theMagicOfAutocomplete.go @@ -174,16 +174,16 @@ func prepareStdout() { me.pb.HelpCounter = 0 } } else { - if me.autoFunc == nil { - me.pb.SubCommand(me.pb.Real...) - } else { - me.autoFunc(me.pb) // run the autocomplete function the user made for their application - } - 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 - } + // if me.autoFunc == nil { + // me.pb.SubCommand(me.pb.Real...) + // } else { + me.autoFunc(me.pb) // run the autocomplete function the user made for their application + // } + // 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 + // } } fmt.Fprintf(Stderr, "got to the end err(%v)\n", me.Err) return |
