finally fix https://github.com/adoyle-h/bash-completor/discussions/2 by just using the rc-scripts directly

This commit is contained in:
Thomas von Dein
2023-09-19 16:59:11 +02:00
parent cbac202c38
commit f43da7f0b0

View File

@@ -21,14 +21,16 @@ reply_version() {
COMPREPLY=( $(compgen -W "${versions[*]}" -- "$cur") ) COMPREPLY=( $(compgen -W "${versions[*]}" -- "$cur") )
} }
# reply_rcscripts() { # we're taking the easy path here. There might be cases where the
# local jail=${COMP_WORDS[2]} # $name_enable variable doesn't match the actual rc-Script, which
# local scripts=$(jaildk _get_rc_scripts $jail | sed 's|.*/||') # we will not catch the way we're doing it here, but these are rare
# scripts=${scripts//$'\n'/ } # and the user can specify something manually as well. Also this
# scripts=${scripts//$'\r'/} # method is way faster than executing rcorder inside the jail
# echo "[jail=$jail] [cur=$cur] [scripts=${scripts[*]}]" > debug.log reply_rcscripts() {
# COMPREPLY=( $(compgen -W "${scripts[*]}" -- "$cur") ) local jail=${COMP_WORDS[2]}
# } local scripts=$(ls $JAILDIR/run/$jail/usr/local/etc/rc.d)
COMPREPLY=( $(compgen -W "${scripts[*]}" -- "$cur") )
}
functions='mount,ports,mtree,pf' functions='mount,ports,mtree,pf'
modes='start,stop,status,restart' modes='start,stop,status,restart'
@@ -78,7 +80,7 @@ subcmd_opts_status=(-v)
subcmd_args_status=@jail subcmd_args_status=@jail
### sub cmd rc ### sub cmd rc
subcmd_opts_rc=(-m:$modes -r) subcmd_opts_rc=(-m:$modes -r:@rcscripts)
subcmd_args_rc=@jail subcmd_args_rc=@jail
### sub cmd ipfw ### sub cmd ipfw