mirror of
https://github.com/notwa/rc
synced 2024-05-18 09:53:22 -07:00
allow multiple tableize flags per line
This commit is contained in:
parent
09fe2321f8
commit
a7a702c368
48
tableize
48
tableize
|
@ -40,27 +40,39 @@ tableize() {
|
||||||
decom="${decom#${decom%%[! ]*}}" # ltrim
|
decom="${decom#${decom%%[! ]*}}" # ltrim
|
||||||
decom="${decom%${decom##*[! ]}}" # rtrim
|
decom="${decom%${decom##*[! ]}}" # rtrim
|
||||||
|
|
||||||
|
_pref=
|
||||||
case "$decom" in
|
case "$decom" in
|
||||||
YES_ZSH) zsh=yes;;
|
('!/bin/sh') _pref=sh;;
|
||||||
YES_BASH) bash=yes;;
|
('!/usr/bin/env ash') _pref=ash;;
|
||||||
YES_DASH) dash=yes;;
|
('!/usr/bin/env bash') _pref=bash;;
|
||||||
YES_ASH) ash=yes;;
|
('!/usr/bin/env dash') _pref=dash;;
|
||||||
FAKE_COMPAT) zsh=yes; bash=yes; dash=yes; ash=yes;;
|
('!/usr/bin/env false') _pref=false;;
|
||||||
NO_ZSH) zsh=no;;
|
('!/usr/bin/env perl') _pref=perl;;
|
||||||
NO_BASH) bash=no;;
|
('!/usr/bin/env sh') _pref=sh;;
|
||||||
NO_DASH) dash=no;;
|
('!/usr/bin/env zsh') _pref=zsh;;
|
||||||
NO_ASH) ash=no;;
|
('!/usr/bin/sh') _pref=sh;;
|
||||||
'!/bin/sh') pref=sh;;
|
|
||||||
'!/usr/bin/env ash') pref=ash;;
|
|
||||||
'!/usr/bin/env bash') pref=bash;;
|
|
||||||
'!/usr/bin/env dash') pref=dash;;
|
|
||||||
'!/usr/bin/env false') pref=false;;
|
|
||||||
'!/usr/bin/env perl') pref=perl;;
|
|
||||||
'!/usr/bin/env sh') pref=sh;;
|
|
||||||
'!/usr/bin/env zsh') pref=zsh;;
|
|
||||||
'!/usr/bin/sh') pref=sh;;
|
|
||||||
#*) printf '\033[1mno match:\033[0m [%s]\n' "$decom";;
|
#*) printf '\033[1mno match:\033[0m [%s]\n' "$decom";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -n "$_pref" ]; then
|
||||||
|
pref="$_pref"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -f
|
||||||
|
IFS=' '
|
||||||
|
for flag in $decom; do case "$flag" in
|
||||||
|
(YES_ZSH) zsh=yes;;
|
||||||
|
(YES_BASH) bash=yes;;
|
||||||
|
(YES_DASH) dash=yes;;
|
||||||
|
(YES_ASH) ash=yes;;
|
||||||
|
(FAKE_COMPAT) zsh=yes; bash=yes; dash=yes; ash=yes;;
|
||||||
|
(NO_ZSH) zsh=no;;
|
||||||
|
(NO_BASH) bash=no;;
|
||||||
|
(NO_DASH) dash=no;;
|
||||||
|
(NO_ASH) ash=no;;
|
||||||
|
('#'*) break;;
|
||||||
|
esac done
|
||||||
done < "$f"
|
done < "$f"
|
||||||
|
|
||||||
#printf '%s' "script $fn has a preference for $pref and support for" >&2
|
#printf '%s' "script $fn has a preference for $pref and support for" >&2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user