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.
This commit is contained in:
Martin Atkins 2017-09-25 18:09:19 -07:00
parent 9b5ae9143a
commit 82fefbc599

17
command/autocomplete.go Normal file
View File

@ -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