mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Merge pull request #2855 from hashicorp/f-autocomplete-files
Autocomplete files
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/hashicorp/nomad/api"
|
||||
"github.com/hashicorp/nomad/scheduler"
|
||||
"github.com/mitchellh/colorstring"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -77,6 +78,14 @@ func (c *PlanCommand) Synopsis() string {
|
||||
return "Dry-run a job update to determine its effects"
|
||||
}
|
||||
|
||||
func (c *PlanCommand) AutocompleteFlags() complete.Flags {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *PlanCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictOr(complete.PredictFiles("*.nomad"), complete.PredictFiles("*.hcl"))
|
||||
}
|
||||
|
||||
func (c *PlanCommand) Run(args []string) int {
|
||||
var diff, verbose bool
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/hashicorp/nomad/api"
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -96,6 +97,14 @@ func (c *RunCommand) Synopsis() string {
|
||||
return "Run a new job or update an existing job"
|
||||
}
|
||||
|
||||
func (c *RunCommand) AutocompleteFlags() complete.Flags {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *RunCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictOr(complete.PredictFiles("*.nomad"), complete.PredictFiles("*.hcl"))
|
||||
}
|
||||
|
||||
func (c *RunCommand) Run(args []string) int {
|
||||
var detach, verbose, output bool
|
||||
var checkIndexStr, vaultToken string
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/hashicorp/nomad/api"
|
||||
"github.com/hashicorp/nomad/command/agent"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
type ValidateCommand struct {
|
||||
@@ -33,6 +34,14 @@ func (c *ValidateCommand) Synopsis() string {
|
||||
return "Checks if a given job specification is valid"
|
||||
}
|
||||
|
||||
func (c *ValidateCommand) AutocompleteFlags() complete.Flags {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ValidateCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictOr(complete.PredictFiles("*.nomad"), complete.PredictFiles("*.hcl"))
|
||||
}
|
||||
|
||||
func (c *ValidateCommand) Run(args []string) int {
|
||||
flags := c.Meta.FlagSet("validate", FlagSetNone)
|
||||
flags.Usage = func() { c.Ui.Output(c.Help()) }
|
||||
|
||||
Reference in New Issue
Block a user