1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-04-24 09:03:22 -07:00

add handling for perl to compatibility table

This commit is contained in:
Connor Olding 2021-10-29 16:22:13 +02:00
parent a0c83289e3
commit 4c128d42f8

View File

@ -55,6 +55,7 @@ tableize() {
'!/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;;
@ -72,16 +73,22 @@ tableize() {
local yay='✔️' # yay='y'
local nay='⭕' # nay='✖️' # nay='n'
local huh='❔' # huh='?'
local etc='*n/a*'
# TODO: escape underscores in filenames.
printf '| [%s](#%s) ' "$fn" "$fn"
printf "%$(( 40 - 2 * ${#fn} ))s" '' # funky way to pad the rest of the column
[ "$pref" != false ] || pref='**false**'
[ "$pref" != sh ] || pref='*sh*'
[ -n "$pref" ] && printf '| %10s ' "$pref" || printf '| %9s%s ' '' "$huh"
local p="$pref"
[ "$pref" != false ] || p='**false**'
[ "$pref" != perl ] || p='**perl**'
[ "$pref" != sh ] || p='*sh*'
[ -n "$p" ] && printf '| %10s ' "$p" || printf '| %9s%s ' '' "$huh"
local t=
for t in "$zsh" "$bash" "$dash" "$ash"; do
local w="$huh"
[ "$pref" != perl ] || w="$etc"
[ "$t" != yes ] || w="$yay"
[ "$t" != no ] || w="$nay"
# can't use '%4s' here because printf gets confused by UTF-8.