summaryrefslogtreecommitdiff
path: root/complete.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-11 00:38:24 +0300
committerEyal Posener <[email protected]>2017-05-11 02:16:39 +0300
commit72dfe017e9209c1809cfcfcbd9039551fe4d2103 (patch)
tree4881f90157f3605fbb488c32e0faae7dff1bc818 /complete.go
parent1c743d8c0b8235ea2dbf0856987f8bd5b77a0042 (diff)
Improve files and directories completion
Diffstat (limited to 'complete.go')
-rw-r--r--complete.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/complete.go b/complete.go
index 925c9a2..c91bf5f 100644
--- a/complete.go
+++ b/complete.go
@@ -59,11 +59,12 @@ func (c *Complete) Run() bool {
// complete get a command an command line arguments and returns
// matching completion options
func complete(c Command, args []string) (matching []string) {
- options, _ := c.options(args[:len(args)-1])
+ options, _ := c.options(args)
// choose only matching options
l := last(args)
for _, option := range options {
+ Log("option %T, %s -> %t", option, option, option.Match(l))
if option.Match(l) {
matching = append(matching, option.String())
}
@@ -87,6 +88,7 @@ func last(args []string) (last string) {
}
func output(options []string) {
+ Log("")
// stdout of program defines the complete options
for _, option := range options {
fmt.Println(option)