mirror of https://github.com/dyne/zuper.git
simplified, endgame() now implicitly called by zshexit at end of execution
This commit is contained in:
parent
c59ed6b7bd
commit
3d0ff5d069
|
|
@ -104,8 +104,7 @@ for i in ${(k)mymap}; do
|
||||||
print "$i \t ${mymap[$i]}"
|
print "$i \t ${mymap[$i]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# end the program (call destructors)
|
# end of the program (will call destructors)
|
||||||
endgame
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
16
zuper
16
zuper
|
|
@ -25,7 +25,7 @@
|
||||||
typeset -aU vars
|
typeset -aU vars
|
||||||
typeset -aU arrs
|
typeset -aU arrs
|
||||||
vars=(debug quiet ztmpfile)
|
vars=(debug quiet ztmpfile)
|
||||||
arrs=()
|
arrs=(req freq)
|
||||||
|
|
||||||
debug=${debug:-0}
|
debug=${debug:-0}
|
||||||
quiet=${quiet:-0}
|
quiet=${quiet:-0}
|
||||||
|
|
@ -124,17 +124,8 @@ function _print() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn() {
|
fn() {
|
||||||
local msg="$1"
|
fun="$@"
|
||||||
command -v gettext 1>/dev/null 2>/dev/null \
|
|
||||||
&& msg="$(gettext -s "$1")"
|
|
||||||
for i in $(seq 2 ${#}); do
|
|
||||||
msg=${(S)msg//::$(($i - 1))*::/$*[$i]}
|
|
||||||
done
|
|
||||||
|
|
||||||
fun="$msg"
|
|
||||||
func "$fun"
|
|
||||||
req=()
|
req=()
|
||||||
freq=()
|
freq=()
|
||||||
}
|
}
|
||||||
|
|
@ -215,6 +206,9 @@ endgame() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Register endgame() to be called at exit.
|
||||||
|
# unlike TRAPEXIT, the zshexit() hook is not called when functions exit.
|
||||||
|
zshexit() { endgame EXIT; return $? }
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Temp file handling
|
# Temp file handling
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue