mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 09:55:44 +03:00
Merge pull request #2866 from hashicorp/f-autocomplete-agent
Agent command autocompletes to hcl/json files
This commit is contained in:
@@ -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: "==> ",
|
||||
|
||||
Reference in New Issue
Block a user