mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
bash-completion: use a better definition of __contains_word
- scope the iterator var - use the correct, quoted, non-expansion prone positional parameter notation - prevent expansion on RHS of comparison - remove unneeded explicit returns. This really should be defined only once...
This commit is contained in:
parent
751e75769a
commit
a72d698d0d
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
_hostnamectl() {
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
_localectl() {
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
__get_all_sessions () { loginctl list-sessions | { while read -r a b; do printf "%s\n" "$a"; done; } ; }
|
||||
|
@ -32,9 +32,10 @@ __systemd_properties() {
|
||||
}
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
__filter_units_by_property () {
|
||||
|
@ -19,9 +19,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
_systemd_analyze() {
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
__journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
_timedatectl() {
|
||||
|
@ -18,9 +18,10 @@
|
||||
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
__contains_word () {
|
||||
local word=$1; shift
|
||||
for w in $*; do [[ $w = $word ]] && return 0; done
|
||||
return 1
|
||||
local w word=$1; shift
|
||||
for w in "$@"; do
|
||||
[[ $w = "$word" ]] && return
|
||||
done
|
||||
}
|
||||
|
||||
__get_all_sysdevs() {
|
||||
|
Loading…
Reference in New Issue
Block a user