diff options
| author | Jeff Carr <[email protected]> | 2025-10-17 05:36:18 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-17 05:36:18 -0500 |
| commit | 555c8cd918b1253723464604d6871185991e5edc (patch) | |
| tree | 2d1aabdc97047005e75bc505fd1fe8936524522d /sendStrings.go | |
| parent | 6294b7b53c94fa77ac8ef3ba466b1cf032bdc6a8 (diff) | |
rename files to help organize my thoughts
Diffstat (limited to 'sendStrings.go')
| -rw-r--r-- | sendStrings.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/sendStrings.go b/sendStrings.go deleted file mode 100644 index 827e690..0000000 --- a/sendStrings.go +++ /dev/null @@ -1,70 +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" - - "go.wit.com/log" -) - -// 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) - } - fmt.Printf("%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) { - partial := strings.Trim(pb.Partial, "'") - 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") - } - me.pp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, partial, cmd...) - // me.pp.GetUsageForSubcommand(os.Stdout, os.Stderr, partial, cmd) - // me.pp.GetUsageForSubcommand(os.Stdout, nil, partial, cmd) - } else { - f, _ := os.OpenFile("/tmp/outlook", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - me.pp.WriteHelpForAutocomplete(f, os.Stdout, partial, cmd...) - // me.pp.GetUsageForSubcommand(os.Stdout, nil, partial, cmd) - } - os.Exit(0) -} |
