blob: 633d3e6b1bd13bf73f5b14c7f7f510859732c316 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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")
}
}
*/
}
|