SC2039 - We simply have to use `local` whenever it's possible, and
although it's not defined in POSIX, most common shells do support it
(well, at least Dash, Bash and Zsh).
SC1090 - Sourcing non-constant file is pretty much the main idea of
Shellfu, so avoiding that part does not make sense.
Move SHELLFU_DEBUG* and SHELLFU_VERBOSE to pretty where they belong
These variables are not specific to shellfu internals but in all ways
specific to pretty.sh module. The prefix is mostly historical cruft.
Let's clean that up.
shellfu-get (whose only job is to print one of hardcoded strings depending
on $1) and shellfu.sh should be as light as possible. Most of this code
is only useful (and intended) for library exploration, which is domain
of shellfu-doc.
A neat side-effect is, that in its new home, we don't have to be so
fussy about performance and footprinting, so we can afford luxury such
as putting code into functions and documenting them, using $1 for first
argument, using shellfu libraries(!)...
Needless to say, this is an incompatible CLI change (or it would have
half the effect), so we take the opportunity to re-do the CLI to match
the new home.
It's rather useless in load-time, since the environment is often
tailored since then (e.g. SHELLFU_PATH is the most obvious example).
By far most realistic use case is import; even those related sub-commands
are always used along with import anyway.
A little improved module finder now
* ignores non-directories (incl. non-existent),
* sends path to debug before visit,
* and is safe against paths with spaces,
but as a side effect
* invokes find per (valid directory) path.
A library can now have init function to allow for more dynamic behavior.
The function's name must be __ffoo_NAME__init, where NAME is the library
name.
Note that the init exit status is used as exit status of the `ffoo
import NAME` call (or `ffoo try_import NAME`) and overrides exit
status of the sourcing (which must always be zero anyway).