From faa5368bc50c84c3a1dfaf67bc21c2cd2bbb921f Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Thu, 28 Nov 2019 19:24:35 +0000 Subject: completion --- cmd/license/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cmd') diff --git a/cmd/license/main.go b/cmd/license/main.go index d45b30f..738cf2e 100644 --- a/cmd/license/main.go +++ b/cmd/license/main.go @@ -12,6 +12,7 @@ import ( "text/template" "time" + "github.com/posener/complete" "within.website/x/cmd/license/licenses" "within.website/x/internal" ) @@ -33,6 +34,15 @@ func init() { fmt.Fprintln(os.Stderr, "\nBy default the name and email are scraped from `git config`") os.Exit(2) } + + var names []string + for name := range licenses.List { + names = append(names, name) + } + + sort.Strings(names) + + internal.HandleCompletion(complete.PredictSet(names...), nil) } func main() { -- cgit v1.2.3