1
0

zsh: update

This commit is contained in:
2024-01-27 00:10:58 +03:00
parent d5209414e9
commit 9d1de60648
21 changed files with 258 additions and 81 deletions

View File

@@ -1,17 +1,25 @@
#!/bin/zsh
kconf-set() {
local n v
[ -n "${1:?}" ] || return 1
n=$1 v=$2 ; shift 2
grep -ElZ "^((CONFIG_)?$n=|# (CONFIG_)?$n is not set)" "$@" \
local n=$1 v=$2
shift 2
[ $# -gt 0 ] || return 2
command 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
[ -n "${1:?}" ] || return 1
n=$1 ; shift
grep -ElZ "^(CONFIG_)?$n=" "$@" \
local n=$1
shift
[ $# -gt 0 ] || return 2
command grep -ElZ "^(CONFIG_)?$n=" "$@" \
| xargs -0 -r sed -i -E -e "s/^((CONFIG_)?$n)=.+\$/# \\1 is not set/"
}