1
0

zsh: treewide: minor fixes/style

This commit is contained in:
2022-07-19 02:41:45 +03:00
parent 0ec196bef2
commit 724df8e2d8
21 changed files with 102 additions and 51 deletions

View File

@@ -1,11 +1,14 @@
#!/bin/zsh
gpg-warmup() {
local t r
(( ${+commands[gpg]} )) || return 1
local r t
t=$(mktemp)
command gpg -abs "$t"
r=$?
command rm -f "$t" "$t.asc"
return "$r"
}

View File

@@ -2,9 +2,11 @@
z-alt-grep() {
local -a a
local n
a=( ${(@s:|:)1} )
[ ${#a} = 0 ] && a=( "$1" )
local n=${#a}
n=${#a}
[ -z "$1" ] && n=0
case "$n" in
0) ;;

View File

@@ -2,6 +2,7 @@
idle() {
local f
f=$(type "$1")
case "$f" in
"$1 is /"*) z-idle-ext "$@" ;;
@@ -11,6 +12,7 @@ idle() {
z-idle-ext() {
local -a s
s+=( $(z-alt-find 'nice -n +40') )
s+=( $(z-alt-find 'chrt -i 0' ) )
s+=( $(z-alt-find 'ionice -c 3') )

View File

@@ -1,13 +1,17 @@
#!/bin/zsh
kconf-set() {
local n=$1 v=$2 ; shift 2
local n v
n=$1 v=$2 ; shift 2
grep -ElZ "^((CONFIG_)?$n=|# (CONFIG_)?$n is not set)" "$@" \
| xargs -0 -r sed -i -E -e "s/^(((CONFIG_)?$n)=.+|# ((CONFIG_)?$n) is not set)\$/\\2\\4=$v/"
}
kconf-unset() {
local n=$1 ; shift
local n
n=$1 ; shift
grep -ElZ "^(CONFIG_)?$n=" "$@" \
| xargs -0 -r sed -i -E -e "s/^((CONFIG_)?$n)=.+\$/# \\1 is not set/"
}

View File

@@ -10,9 +10,11 @@ esac
z-alt-ls() {
local -a a
local n
a=( ${(@s:|:)1} )
[ ${#a} = 0 ] && a=( "$1" )
local n=${#a}
n=${#a}
[ -z "$1" ] && n=0
case "$n" in
0) ;;