backport of commit 0748918a3a355ad5616e32c1aad041321a771418 (#18919)

Co-authored-by: Dave May <dmay@hashicorp.com>
This commit is contained in:
hc-github-team-nomad-core 2023-10-30 13:00:40 -05:00 committed by GitHub
parent 1a0fb2f4fa
commit 74e03514fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 7 deletions

3
.changelog/18901.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
cli: Add file prediction for operator raft/snapshot commands
```

View File

@ -36,7 +36,7 @@ func (c *OperatorRaftInfoCommand) AutocompleteFlags() complete.Flags {
} }
func (c *OperatorRaftInfoCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorRaftInfoCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*")
} }
func (c *OperatorRaftInfoCommand) Synopsis() string { func (c *OperatorRaftInfoCommand) Synopsis() string {

View File

@ -45,7 +45,7 @@ func (c *OperatorRaftLogsCommand) AutocompleteFlags() complete.Flags {
} }
func (c *OperatorRaftLogsCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorRaftLogsCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*")
} }
func (c *OperatorRaftLogsCommand) Synopsis() string { func (c *OperatorRaftLogsCommand) Synopsis() string {

View File

@ -42,11 +42,13 @@ Options:
} }
func (c *OperatorRaftStateCommand) AutocompleteFlags() complete.Flags { func (c *OperatorRaftStateCommand) AutocompleteFlags() complete.Flags {
return complete.Flags{} return complete.Flags{
"-last-index": complete.PredictNothing,
}
} }
func (c *OperatorRaftStateCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorRaftStateCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*")
} }
func (c *OperatorRaftStateCommand) Synopsis() string { func (c *OperatorRaftStateCommand) Synopsis() string {

View File

@ -33,7 +33,7 @@ func (c *OperatorSnapshotInspectCommand) AutocompleteFlags() complete.Flags {
} }
func (c *OperatorSnapshotInspectCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorSnapshotInspectCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*.snap")
} }
func (c *OperatorSnapshotInspectCommand) Synopsis() string { func (c *OperatorSnapshotInspectCommand) Synopsis() string {

View File

@ -46,7 +46,7 @@ func (c *OperatorSnapshotRestoreCommand) AutocompleteFlags() complete.Flags {
} }
func (c *OperatorSnapshotRestoreCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorSnapshotRestoreCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*.snap")
} }
func (c *OperatorSnapshotRestoreCommand) Synopsis() string { func (c *OperatorSnapshotRestoreCommand) Synopsis() string {

View File

@ -43,7 +43,7 @@ func (c *OperatorSnapshotStateCommand) AutocompleteFlags() complete.Flags {
} }
func (c *OperatorSnapshotStateCommand) AutocompleteArgs() complete.Predictor { func (c *OperatorSnapshotStateCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing return complete.PredictFiles("*.snap")
} }
func (c *OperatorSnapshotStateCommand) Synopsis() string { func (c *OperatorSnapshotStateCommand) Synopsis() string {