elvish_config/aliases/commit-kcp.elv

21 lines
436 B
Plaintext

edit:add-var commit-kcp~ {|@argv|
use str
var m = [
&name=
&ver=
]
keys $m | each {|k|
var p = (printf 'pkg%s=' $k)
set m[$k] = (str:trim-prefix (cat PKGBUILD | grep $p | take 1) $p)
}
var msg = (printf '%s %s' $m[name] $m[ver])
if (> (count $argv) 0) {
set msg = (printf '%s - %s' $msg (str:join ' ' $argv))
}
printf "git commit -am '%s'; git push\n" $msg
git commit -am $msg; git push
}