package prep // initializes logging and command line options import ( "fmt" "os" "strings" "time" ) // todo: move everything to this? func (pb *Auto) Autocomplete3(sendthis []string) { pb.Autocomplete2(strings.Join(sendthis, " ")) } func (pb *Auto) Autocomplete2(sendthis string) { dur := pb.Duration.AsDuration() if dur < time.Millisecond*200 { pb.Debug = true /* pb.Debugf("TODO: show extended help here '%s' '%s' %v dur=%v\n", pb.Arg0, pb.Arg1, pb.Argv, config.FormatDuration(dur)) pb.PrintDebug() fmt.Println(" ") */ if myAuto.pp == nil { pb.Debugf("myAuto.pp == nil") } else { pb.Debugf("myAuto.pp != nil") if pb.Cmd == "" { myAuto.pp.WriteHelp(os.Stderr) } else { myAuto.pp.WriteHelpForSubcommand(os.Stderr, pb.Cmd) } } } 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, " ")) /* if dur > time.Millisecond*200 { if dur < time.Millisecond*800 { // fmt.Println("a b") fmt.Println(pb.Partial + " hello world") } } */ }