Skip to content

Commit ef0496f

Browse files
author
Mrunal Patel
authored
Merge pull request #193 from Mashimiao/completions-update-for-ocitools
completions: update based current implementation
2 parents b61b44a + 3de5dd6 commit ef0496f

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

completions/bash/oci-runtime-tool

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ __oci-runtime-tool_nospace() {
108108
type compopt &>/dev/null && compopt -o nospace
109109
}
110110

111+
__oci-runtime-tool_complete_log_level() {
112+
COMPREPLY=( $( compgen -W "
113+
debug
114+
error
115+
fatal
116+
info
117+
panic
118+
warn
119+
" -- "$cur" ) )
120+
}
121+
111122
__oci-runtime-tool_complete_propagations() {
112123
COMPREPLY=( $( compgen -W "
113124
private
@@ -206,21 +217,34 @@ __oci-runtime-tool_complete_capabilities() {
206217

207218
# global options that may appear after the oci-runtime-tool command
208219
_oci-runtime-tool_oci-runtime-tool() {
220+
local options_with_args="
221+
--log-level
222+
"
223+
209224
local boolean_options="
210225
$global_boolean_options
211226
--help
227+
--host-specific
212228
--version -v
213229
"
214230

231+
local all_options="$options_with_args $boolean_options"
232+
215233
case "$prev" in
216234
$(__oci-runtime-tool_to_extglob "$global_options_with_args") )
217235
return
218236
;;
237+
238+
--log-level)
239+
__oci-runtime-tool_complete_log_level
240+
return
241+
;;
242+
219243
esac
220244

221245
case "$cur" in
222246
-*)
223-
COMPREPLY=( $( compgen -W "$boolean_options $global_options_with_args" -- "$cur" ) )
247+
COMPREPLY=( $( compgen -W "$all_options $global_options_with_args" -- "$cur" ) )
224248
;;
225249
*)
226250
local counter=$( __oci-runtime-tool_pos_first_nonflag $(__oci-runtime-tool_to_extglob "$global_options_with_args") )
@@ -253,7 +277,7 @@ _oci-runtime-tool_validate() {
253277

254278
case "$cur" in
255279
-*)
256-
COMPREPLY=( $( compgen -W "--host-specific --path --help" -- "$cur" ) )
280+
COMPREPLY=( $( compgen -W "--path --help" -- "$cur" ) )
257281
;;
258282
esac
259283

man/oci-runtime-tool.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ oci-runtime-tool is a collection of tools for working with the [OCI runtime spec
2929
With this flag, validation will also run more specific tests to see whether
3030
the current host is capable of launching a container from the configuration.
3131

32-
**--log-level**
32+
**--log-level**=LEVEL
3333
Log level (panic, fatal, error, warn, info, or debug) (default: "error").
3434

3535
**-v**, **--version**

0 commit comments

Comments
 (0)