App-mdee
view release on metacpan or search on metacpan
[ table | # table formatting ]=_
[ trim | # trim table cell spaces]=1
[ nup | # use nup ]=_
[ rule | # table rule lines ]=_
```
- `fold`/`table`/`nup`/`rule` default to sentinel `_` (not user-set)
- `trim` defaults to `1` (always on unless explicitly `--no-trim`), not style-dependent
- After getoptlong.sh, style defaults are applied only to sentinel values
- Explicit `--fold`/`--no-fold` sets the value to `1`/empty, overriding style
- `filter()` and `plain()` callbacks set `$style` during option parsing
- The `!` marker triggers the callback when option is parsed
```bash
filter() { style=filter; }
plain() { [[ $plain ]] && style=pager || style=nup; }
# After getoptlong.sh:
case $style in
nup) style_defaults=([fold]=1 [table]=1 [nup]=1 [rule]=1) ;;
pager) style_defaults=([fold]=1 [table]=1 [nup]= [rule]=1) ;;
script/mdee view on Meta::CPAN
# Returns "dark" if luminance < 50, "light" otherwise
# Returns empty string if luminance cannot be determined
detect_terminal_mode() {
local lum
lum=$(perl -MGetopt::EX::termcolor=luminance -e luminance 2>/dev/null) || return
[[ $lum ]] || return
(( lum < 50 )) && echo dark || echo light
}
##############################################################################
# Option callbacks
##############################################################################
help() {
sed -E \
-e '/^$/N' \
-e 's/^(\n*)=head[0-9]* */\1/' \
-e '/^\n*[#=]/d' \
-e '/Version/q' \
<<< "$pod"
exit 0
( run in 1.563 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )