From 04f1a4cc98ed6bfc8c924e8cb411558e0961fb44 Mon Sep 17 00:00:00 2001 From: rajasec Date: Thu, 8 Sep 2016 12:14:42 +0530 Subject: [PATCH] Adding bash completion for create and run Signed-off-by: rajasec --- contrib/completions/bash/runc | 63 ++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/contrib/completions/bash/runc b/contrib/completions/bash/runc index eacd3a00..f19adf1f 100644 --- a/contrib/completions/bash/runc +++ b/contrib/completions/bash/runc @@ -430,13 +430,14 @@ _runc_spec() { esac } -_runc_start() { +_runc_run() { local boolean_options=" --help --detatch -d --no-subreaper --no-pivot + --no-new-keyring " local options_with_args=" @@ -534,6 +535,49 @@ _runc_checkpoint() { ;; esac } +_runc_create() { + local boolean_options=" + --help + --no-pivot + --no-new-keyring + " + + local options_with_args=" + --bundle + -b + --console + --pid-file + " + case "$prev" in + --bundle|-b|--console|--pid-file) + case "$cur" in + '') + COMPREPLY=( $( compgen -W '/' -- "$cur" ) ) + __runc_nospace + ;; + /*) + _filedir + __runc_nospace + ;; + esac + return + ;; + + $(__runc_to_extglob "$options_with_args")) + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) + ;; + *) + __runc_list_all + ;; + esac + +} _runc_help() { local counter=$(__runc_pos_first_nonflag) @@ -635,6 +679,21 @@ _runc_state() { ;; esac } +_runc_start() { + local boolean_options=" + --help + -h + " + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "$boolean_options $options_with_args" -- "$cur" ) ) + ;; + *) + __runc_list_all + ;; + esac +} _runc_update() { local boolean_options=" --help @@ -677,6 +736,7 @@ _runc() { local commands=( checkpoint + create delete events exec @@ -686,6 +746,7 @@ _runc() { pause restore resume + run spec start state