2017-07-19 22:20:28 -07:00
|
|
|
# Show information about the named var(s) passed to us.
|
|
|
|
function show --no-scope-shadowing
|
2017-07-26 20:17:04 -07:00
|
|
|
for _v in $argv
|
|
|
|
if set -q $_v
|
|
|
|
set -l _c (count $$_v)
|
|
|
|
printf '$%s count=%d\n' $_v $_c
|
2017-07-19 23:14:37 -07:00
|
|
|
# This test is to work around a bogosity of the BSD `seq` command. If called with
|
|
|
|
# `seq 0` it emits `1`, `0`. Whereas that GNU version outputs nothing.
|
2017-07-26 20:17:04 -07:00
|
|
|
if test $_c -gt 0
|
|
|
|
for i in (seq $_c)
|
|
|
|
printf '$%s[%d]=|%s|\n' $_v $i $$_v[1][$i]
|
2017-07-19 23:14:37 -07:00
|
|
|
end
|
2017-07-19 22:20:28 -07:00
|
|
|
end
|
|
|
|
else
|
2017-07-26 20:17:04 -07:00
|
|
|
echo \$$_v is not set
|
2017-07-19 22:20:28 -07:00
|
|
|
end
|
|
|
|
end
|
2017-07-12 22:12:41 -07:00
|
|
|
end
|