Skip to content

Commit a9ae9af

Browse files
committed
Add completion for --output option for version command.
1 parent 85b00f1 commit a9ae9af

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pgbackrest-completion.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ __pgbackrest_command_options_values() {
2727
echo ${command_options_values}
2828
}
2929

30-
# The '--output' option is available for 'repo-ls' and 'info' commands with the same values.
30+
# The '--output' option is available for 'repo-ls', 'manifest' and 'info' commands with the same values.
3131
# For 'repo-ls' command displayed additional information in the same format.
3232
# To simplify the solution and not write additional regexp, the option values are specified directly.
3333
__pgbackrest_command_options_values_output() {
@@ -36,11 +36,16 @@ __pgbackrest_command_options_values_output() {
3636

3737
# The '--output' option is available for 'verify' command with another values.
3838
# As well as other formatting of the hint text.
39-
# When new commands with unique options list appear, refactoring will be required.
4039
__pgbackrest_command_options_values_output_verify() {
4140
echo "none"$'\n'"text"
4241
}
4342

43+
# The '--output' option is available for 'version' command with another values.
44+
# As well as other formatting of the hint text.
45+
__pgbackrest_command_options_values_output_version() {
46+
echo "text"$'\n'"num"
47+
}
48+
4449
# The '--buffer-size' displays values in the user friendly format starting from pgBackRest v2.37.
4550
# In earlier versions, values in bytes will be substituted.
4651
# https://github.com/pgbackrest/pgbackrest/pull/1557
@@ -173,6 +178,9 @@ _pgbackrest() {
173178
verify)
174179
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output_verify)" -- ${cur}))
175180
return 0;;
181+
version)
182+
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output_version)" -- ${cur}))
183+
return 0;;
176184
*)
177185
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output)" -- ${cur}))
178186
return 0;;
@@ -250,6 +258,9 @@ _pgbackrest() {
250258
verify)
251259
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output_verify)" -- ${cur}))
252260
return 0;;
261+
version)
262+
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output_version)" -- ${cur}))
263+
return 0;;
253264
*)
254265
COMPREPLY=($(compgen -W "$(__pgbackrest_command_options_values_output)" -- ${cur}))
255266
return 0;;

0 commit comments

Comments
 (0)