1
0
Fork 0
mirror of synced 2024-05-26 03:51:13 -04:00
zimfw/src/stage2/31_zimfw_source_zimrc.zsh.erb
Eric Nielsen 6129062139
Fail when no modules defined in .zimrc
instead of allowing xargs to execute the action with no positional
parameters.

Also don't try to write to .latest_version if there's no write
permission. This is supposed to be a background/optional operation, so
we don't want to show an error message in this case.

And use Zsh globs instead of find with -exec, and find won't fail if
there's an error with the -exec command.
2020-01-26 15:33:17 -05:00

14 lines
415 B
Plaintext

_zimfw_source_zimrc() {
local -r ztarget=<%= home %>/.zimrc
local -ri _zprepare_xargs=${1}
local -i _zfailed=0
if ! source ${ztarget} || (( _zfailed )); then
print -u2 -PR "%F{red}<%= failed %>Failed to source %B${ztarget}%b%f"
return 1
fi
if (( _zprepare_xargs && ! ${#_zmodules_xargs} )); then
print -u2 -PR "%F{red}<%= failed %>No modules defined in %B${ztarget}%b%f"
return 1
fi
}