From 508d880864ac0c853a76040458f2c1a3040366c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ed=C3=AAnis=20Freindorfer=20Azevedo?= Date: Fri, 3 Sep 2021 10:01:45 -0300 Subject: [PATCH] Update `_lxc_usernsexec`. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Not really much can be done for this function, as `-m` requires an ID mapping that has to be manually input, since it will use `/etc/sub{g,u}id` if not specified. Signed-off-by: Edênis Freindorfer Azevedo --- config/bash/lxc.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/bash/lxc.in b/config/bash/lxc.in index a4306b496..7254e7351 100644 --- a/config/bash/lxc.in +++ b/config/bash/lxc.in @@ -1124,6 +1124,14 @@ _lxc_update_config() { } && complete -F _lxc_update_config lxc-update-config +__lxc_id_mapping() { + local -r tmp="${cur//[^:]}" + if [[ "${#tmp}" -eq 0 ]]; then + COMPREPLY=( $( compgen -W "u: g: b:" -- "${cur}" ) ) + fi + compopt -o nospace +} + _lxc_usernsexec() { local cur prev words cword split COMPREPLY=() @@ -1139,7 +1147,8 @@ _lxc_usernsexec() { return ;; -m ) - # @TODO: ^[ugb]:[0-9]+:[0-9]+(:[0-9]+)?$ + # ^[ugb]:[0-9]+:[0-9]+(:[0-9]+)?$ + __lxc_id_mapping return ;; -s ) @@ -1152,7 +1161,6 @@ _lxc_usernsexec() { if [[ ${cur} == -* ]]; then COMPREPLY=( $( compgen -W '-h -m -s' -- "${cur}" ) ) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace - return fi } && complete -F _lxc_usernsexec lxc-usernsexec -- 2.47.2