From 82fefbc599837680c85b16ba90f582ae7782b55c Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 25 Sep 2017 18:09:19 -0700 Subject: [PATCH] command: add some common autocomplete predictors We use boolean flags and module sources in a lot of places, so we'll define global predictors for these which we can use across many commands. --- command/autocomplete.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 command/autocomplete.go diff --git a/command/autocomplete.go b/command/autocomplete.go new file mode 100644 index 0000000000..15099fa526 --- /dev/null +++ b/command/autocomplete.go @@ -0,0 +1,17 @@ +package command + +import ( + "github.com/posener/complete" +) + +// This file contains some re-usable predictors for auto-complete. The +// command-specific autocomplete configurations live within each command's +// own source file, as AutocompleteArgs and AutocompleteFlags methods on each +// Command implementation. + +// For completing the value of boolean flags like -foo false +var completePredictBoolean = complete.PredictSet("true", "false") + +// We don't currently have a real predictor for module sources, but +// we'll probably add one later. +var completePredictModuleSource = complete.PredictAnything