I wrote zsh scripts and libraries for more than 15 years now and i'm very opiniated about what a minimal ~/.zshenv
could be.
use POD as documentation system so modules could be documented as well as a perl module.
way to write, document, test and share the code (inspired by the perl syntax and conventions)
uze.zsh is here to be sourced in your ~/.zshenv
or your script so those best practices are available. Now you can write zsh this way: (mir test suite)
uze mir
uze devel/TAP :all
mir_is_loaded ()
for expected ( mir/ed mir/dump ) {
got="$( shush2 whence -wam $expected )"
[[ ${got%: *} == $expected ]]
ok "$expected is ready to use" ||
note "got $got"
}
prove mir_is_loaded
Perl has CPAN, Python has Pypi, Lua has rocks, Javascript has npm, Lilypond has lyp, it's time for zsh to have something similar. you can see modules using uze.
source uze.zsh from your ~/.zshenv
.
For some historical reasons, zsh comes with flaws and conventions are there to make those flaws less annoying. zsh is still relevant for a lot of tasks as it is a dynamic langage comming with lot of features.
see devel-tap repo and test anything protocol.
Testing is very important as your zsh scripts relies on incompatible tools which silently misbehave at runtime (GNU core utils, BSD tools, 9base ...).
It is also recommended to install devel/TAP
so you can write test suites for your
add helpers to embrace some good practices (perl inspired when possible) (yada yada operator, die
, warn
, ...)
it is recommended to install and use the devel/TAP
module to test your programs and modules. see