add global flags to autocomplete

This commit is contained in:
Chelsea Holland Komlo 2017-08-23 21:56:21 +00:00
parent 35f5c8f2dd
commit ed2a544502
26 changed files with 164 additions and 138 deletions

View File

@ -131,10 +131,11 @@ func (c *AgentCheckCommand) checkClientHealth(clientStats map[string]string, min
}
func (c *AgentCheckCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-min-peers": complete.PredictAnything,
"-min-servers": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-min-peers": complete.PredictAnything,
"-min-servers": complete.PredictAnything,
})
}
func (c *AgentCheckCommand) AutocompleteArgs() complete.Predictor {

View File

@ -112,10 +112,11 @@ func (c *ClientConfigCommand) Run(args []string) int {
}
func (c *ClientConfigCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-servers": complete.PredictNothing,
"-update-servers": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-servers": complete.PredictNothing,
"-update-servers": complete.PredictNothing,
})
}
func (c *ClientConfigCommand) AutocompleteArgs() complete.Predictor {

View File

@ -43,10 +43,11 @@ func (c *DeploymentFailCommand) Synopsis() string {
}
func (c *DeploymentFailCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *DeploymentFailCommand) AutocompleteArgs() complete.Predictor {

View File

@ -37,11 +37,12 @@ List Options:
}
func (c *DeploymentListCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
})
}
func (c *DeploymentListCommand) AutocompleteArgs() complete.Predictor {

View File

@ -36,9 +36,10 @@ func (c *DeploymentPauseCommand) Synopsis() string {
}
func (c *DeploymentPauseCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-verbose": complete.PredictNothing,
})
}
func (c *DeploymentPauseCommand) AutocompleteArgs() complete.Predictor {

View File

@ -52,11 +52,12 @@ func (c *DeploymentPromoteCommand) Synopsis() string {
}
func (c *DeploymentPromoteCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-group": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-group": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *DeploymentPromoteCommand) AutocompleteArgs() complete.Predictor {

View File

@ -41,10 +41,11 @@ func (c *DeploymentResumeCommand) Synopsis() string {
}
func (c *DeploymentResumeCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *DeploymentResumeCommand) AutocompleteArgs() complete.Predictor {

View File

@ -43,11 +43,12 @@ func (c *DeploymentStatusCommand) Synopsis() string {
}
func (c *DeploymentStatusCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-verbose": complete.PredictNothing,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-verbose": complete.PredictNothing,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
})
}
func (c *DeploymentStatusCommand) AutocompleteArgs() complete.Predictor {

View File

@ -49,12 +49,13 @@ func (c *EvalStatusCommand) Synopsis() string {
}
func (c *EvalStatusCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-json": complete.PredictNothing,
"-monitor": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-json": complete.PredictNothing,
"-monitor": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
})
}
func (c *EvalStatusCommand) AutocompleteArgs() complete.Predictor {

View File

@ -80,16 +80,17 @@ func (f *FSCommand) Synopsis() string {
}
func (c *FSCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-H": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-job": complete.PredictAnything,
"-stat": complete.PredictNothing,
"-f": complete.PredictNothing,
"-tail": complete.PredictNothing,
"-n": complete.PredictAnything,
"-c": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-H": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-job": complete.PredictAnything,
"-stat": complete.PredictNothing,
"-f": complete.PredictNothing,
"-tail": complete.PredictNothing,
"-n": complete.PredictAnything,
"-c": complete.PredictAnything,
})
}
func (f *FSCommand) AutocompleteArgs() complete.Predictor {

View File

@ -42,11 +42,12 @@ func (c *InspectCommand) Synopsis() string {
}
func (c *InspectCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-version": complete.PredictAnything,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-version": complete.PredictAnything,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
})
}
func (c *InspectCommand) AutocompleteArgs() complete.Predictor {

View File

@ -44,12 +44,13 @@ func (c *JobDeploymentsCommand) Synopsis() string {
}
func (c *JobDeploymentsCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
"-latest": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
"-latest": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *JobDeploymentsCommand) AutocompleteArgs() complete.Predictor {

View File

@ -57,11 +57,12 @@ func (c *JobDispatchCommand) Synopsis() string {
}
func (c *JobDispatchCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-meta": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-meta": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *JobDispatchCommand) AutocompleteArgs() complete.Predictor {

View File

@ -55,13 +55,14 @@ func (c *JobHistoryCommand) Synopsis() string {
}
func (c *JobHistoryCommand) Autocompleteflags() complete.Flags {
return complete.Flags{
"-p": complete.PredictNothing,
"-full": complete.PredictNothing,
"-version": complete.PredictAnything,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-p": complete.PredictNothing,
"-full": complete.PredictNothing,
"-version": complete.PredictAnything,
"-json": complete.PredictNothing,
"-t": complete.PredictAnything,
})
}
func (c *JobHistoryCommand) AutocompleteArgs() complete.Predictor {

View File

@ -53,11 +53,12 @@ func (c *JobPromoteCommand) Synopsis() string {
}
func (c *JobPromoteCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-group": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-group": complete.PredictAnything,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *JobPromoteCommand) AutocompleteArgs() complete.Predictor {

View File

@ -41,10 +41,11 @@ func (c *JobRevertCommand) Synopsis() string {
}
func (c *JobRevertCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *JobRevertCommand) AutocompleteArgs() complete.Predictor {

View File

@ -158,12 +158,13 @@ func (c *KeyringCommand) Synopsis() string {
}
func (c *KeyringCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-install": complete.PredictAnything,
"-list": complete.PredictNothing,
"-remove": complete.PredictAnything,
"-use": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-install": complete.PredictAnything,
"-list": complete.PredictNothing,
"-remove": complete.PredictAnything,
"-use": complete.PredictAnything,
})
}
func (c *KeyringCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing

View File

@ -62,15 +62,16 @@ func (l *LogsCommand) Synopsis() string {
}
func (c *LogsCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-stderr": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-job": complete.PredictAnything,
"-f": complete.PredictNothing,
"-tail": complete.PredictAnything,
"-n": complete.PredictAnything,
"-c": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-stderr": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-job": complete.PredictAnything,
"-f": complete.PredictNothing,
"-tail": complete.PredictAnything,
"-n": complete.PredictAnything,
"-c": complete.PredictAnything,
})
}
func (l *LogsCommand) AutocompleteArgs() complete.Predictor {

View File

@ -46,12 +46,13 @@ func (c *NodeDrainCommand) Synopsis() string {
}
func (c *NodeDrainCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-disable": complete.PredictNothing,
"-enable": complete.PredictNothing,
"-self": complete.PredictNothing,
"-yes": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-disable": complete.PredictNothing,
"-enable": complete.PredictNothing,
"-self": complete.PredictNothing,
"-yes": complete.PredictNothing,
})
}
func (c *NodeDrainCommand) AutocompleteArgs() complete.Predictor {

View File

@ -86,15 +86,16 @@ func (c *NodeStatusCommand) Synopsis() string {
}
func (c *NodeStatusCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-allocs": complete.PredictNothing,
"-json": complete.PredictNothing,
"-self": complete.PredictNothing,
"-short": complete.PredictNothing,
"-stats": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-allocs": complete.PredictNothing,
"-json": complete.PredictNothing,
"-self": complete.PredictNothing,
"-short": complete.PredictNothing,
"-stats": complete.PredictNothing,
"-t": complete.PredictAnything,
"-verbose": complete.PredictNothing,
})
}
func (c *NodeStatusCommand) AutocompleteArgs() complete.Predictor {

View File

@ -34,9 +34,10 @@ List Peers Options:
}
func (c *OperatorRaftListCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-stale": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-stale": complete.PredictAnything,
})
}
func (c *OperatorRaftListCommand) AutocompleteArgs() complete.Predictor {

View File

@ -38,9 +38,10 @@ Remove Peer Options:
}
func (c *OperatorRaftRemoveCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-peer-address": complete.PredictAnything,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-peer-address": complete.PredictAnything,
})
}
func (c *OperatorRaftRemoveCommand) AutocompleteArgs() complete.Predictor {

View File

@ -79,10 +79,11 @@ func (c *PlanCommand) Synopsis() string {
}
func (c *PlanCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-diff": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-diff": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *PlanCommand) AutocompleteArgs() complete.Predictor {

View File

@ -98,13 +98,14 @@ func (c *RunCommand) Synopsis() string {
}
func (c *RunCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-check-index": complete.PredictNothing,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-vault-token": complete.PredictAnything,
"-output": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-check-index": complete.PredictNothing,
"-detach": complete.PredictNothing,
"-verbose": complete.PredictNothing,
"-vault-token": complete.PredictAnything,
"-output": complete.PredictNothing,
})
}
func (c *RunCommand) AutocompleteArgs() complete.Predictor {

View File

@ -37,9 +37,10 @@ Server Members Options:
}
func (c *ServerMembersCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-detailed": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-detailed": complete.PredictNothing,
})
}
func (c *ServerMembersCommand) AutocompleteArgs() complete.Predictor {

View File

@ -52,12 +52,13 @@ func (c *StopCommand) Synopsis() string {
}
func (c *StopCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{
"-detach": complete.PredictNothing,
"-purge": complete.PredictNothing,
"-yes": complete.PredictNothing,
"-verbose": complete.PredictNothing,
}
return mergeAutocompleteFlags(c.Meta.AutocompleteFlags(FlagSetClient),
complete.Flags{
"-detach": complete.PredictNothing,
"-purge": complete.PredictNothing,
"-yes": complete.PredictNothing,
"-verbose": complete.PredictNothing,
})
}
func (c *StopCommand) AutocompleteArgs() complete.Predictor {