From 0ce95ca7df0d741374cd8e12917ba457512e311a Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 18 Sep 2023 18:11:21 +0200 Subject: [PATCH] try to fix rc -r --- TODO | 1 - src/completions.sh | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index caa4105..622b3ab 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -- fix the 3 mode commands to use -m so completion works correctly - vnet ipv6 doesnt work anymore UPDATE: with auto_linklocal seems to work after some seconds - on reboot, no pf will be started diff --git a/src/completions.sh b/src/completions.sh index 2cc6723..45fd4d6 100644 --- a/src/completions.sh +++ b/src/completions.sh @@ -21,6 +21,15 @@ reply_version() { COMPREPLY=( $(compgen -W "${versions[*]}" -- "$cur") ) } +reply_rcscripts() { + local jail=${COMP_WORDS[2]} + local scripts=$(jaildk _get_rc_scripts $jail | sed 's|.*/||') + scripts=${scripts//$'\n'/ } + scripts=${scripts//$'\r'/} + echo "[jail=$jail] [cur=$cur] [scripts=${scripts[*]}]" > debug.log + COMPREPLY=( $(compgen -W "${scripts[*]}" -- "$cur") ) +} + functions='mount,ports,mtree,pf' modes='start,stop,status,restart' @@ -69,7 +78,7 @@ subcmd_opts_status=(-v) subcmd_args_status=@jail ### sub cmd rc -subcmd_opts_rc=(-m:$modes -r) +subcmd_opts_rc=(-m:$modes -r:@rcscripts) subcmd_args_rc=@jail ### sub cmd ipfw