mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
bash-completion: fix completion of complete verbs
When doing 'command verb<TAB>', the arguments for verb would be proposed, but it is too early. We should complete verb first. https://bugs.freedesktop.org/show_bug.cgi?id=74596
This commit is contained in:
@@ -53,7 +53,7 @@ _busctl() {
|
||||
[STANDALONE]='list monitor'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
|
||||
@@ -41,7 +41,7 @@ _hostnamectl() {
|
||||
[NAME]='set-hostname'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
break
|
||||
|
||||
@@ -52,7 +52,7 @@ _localectl() {
|
||||
[X11]='set-x11-keymap'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
break
|
||||
|
||||
@@ -70,7 +70,7 @@ _loginctl () {
|
||||
[ATTACH]='attach'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
|
||||
@@ -146,7 +146,7 @@ _systemctl () {
|
||||
[TARGETS]='set-default'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
|
||||
@@ -39,7 +39,7 @@ _systemd_analyze() {
|
||||
|
||||
_init_completion || return
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
|
||||
@@ -52,7 +52,7 @@ _timedatectl() {
|
||||
[TIME]='set-time'
|
||||
)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
break
|
||||
|
||||
@@ -36,7 +36,7 @@ _udevadm() {
|
||||
|
||||
local verbs=(info trigger settle control monitor hwdb test-builtin test)
|
||||
|
||||
for ((i=0; i <= COMP_CWORD; i++)); do
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}" &&
|
||||
! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then
|
||||
verb=${COMP_WORDS[i]}
|
||||
|
||||
Reference in New Issue
Block a user