Merge pull request #2866 from hashicorp/f-autocomplete-agent

Agent command autocompletes to hcl/json files
This commit is contained in:
Alex Dadgar
2017-07-19 13:18:32 -07:00
committed by GitHub

View File

@@ -27,6 +27,7 @@ import (
"github.com/hashicorp/nomad/nomad/structs/config"
"github.com/hashicorp/scada-client/scada"
"github.com/mitchellh/cli"
"github.com/posener/complete"
)
// gracefulTimeout controls how long we wait before forcefully terminating
@@ -408,6 +409,20 @@ func (c *Command) checkpointResults(results *checkpoint.CheckResponse, err error
}
}
func (c *Command) AutocompleteFlags() complete.Flags {
configFilePredictor := complete.PredictOr(
complete.PredictFiles("*.json"),
complete.PredictFiles("*.hcl"))
return map[string]complete.Predictor{
"-config": configFilePredictor,
}
}
func (c *Command) AutocompleteArgs() complete.Predictor {
return nil
}
func (c *Command) Run(args []string) int {
c.Ui = &cli.PrefixedUi{
OutputPrefix: "==> ",