From 72dfe017e9209c1809cfcfcbd9039551fe4d2103 Mon Sep 17 00:00:00 2001 From: Eyal Posener Date: Thu, 11 May 2017 00:38:24 +0300 Subject: Improve files and directories completion --- complete.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'complete.go') 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) -- cgit v1.2.3