1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00
phorge-phorge/externals/figlet/figlist
epriestley 935ced1edd Include "Figlet" and PEAR "Text_Figlet" in externals
Summary:
Ref T7785. This prepares for (but does not yet use) a pure PHP implementation of Figlet parsing and rendering.

Figlet is somewhat complex, but a parser already exists in PEAR. I'll make sure it's suitable and hook it up in the next diff.

Test Plan: N/A, code not reachable

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9408, T7785

Differential Revision: https://secure.phabricator.com/D14101
2015-09-13 12:30:48 -07:00

64 lines
1.4 KiB
Bash
Executable file

#!/bin/sh -
# figlist by Glenn Chappell <ggc@uiuc.edu>
# figlet release 2.1.1 -- 25 Aug 1994
#
# Lists all fonts and control files in figlet's default font directory.
# Replaces "figlet -F", which was removed from figlet version 2.1.
#
# Usage: figlist [ -d directory ]
DIR=`dirname $0`
FIGLET=$DIR/figlet
# Get figlet version
FIGLETVERSION=`$FIGLET -I1 2>/dev/null`
if [ -z "$FIGLETVERSION" ]; then
FIGLETVERSION=20000
fi
USAGE="Usage: `basename $0` [ -d directory ]"
if [ "$1" = "-d" ]; then
FONTDIROPT="-d $2"
if [ $# -ne 2 ]; then
echo "$USAGE"
exit 1
fi
else
FONTDIROPT=""
if [ $# -ne 0 ]; then
echo "$USAGE"
exit 1
fi
fi
if [ "$FIGLETVERSION" -lt 20100 ]; then
# figlet 2.0
$FIGLET $FONTDIROPT -F
exit
fi
# From here on we may assume figlet 2.1 or later
FONTDIR=`$FIGLET $FONTDIROPT -I2`
FONT=`$FIGLET -I3`
echo "Default font: $FONT"
echo "Font directory: $FONTDIR"
if [ -d "$FONTDIR" ] && [ -r "$FONTDIR" ]; then
cd "$FONTDIR"
if ls *.flf >/dev/null 2>&1 ; then
echo "Figlet fonts in this directory:"
ls *.flf 2>/dev/null | sed s/\.flf$//
else
echo 'No figlet fonts in this directory'
fi
if ls *.flc >/dev/null 2>&1 ; then
echo "Figlet control files in this directory:"
ls *.flc 2>/dev/null | sed s/\.flc$//
else
echo 'No figlet control files in this directory'
fi
else
echo 'Unable to open directory'
fi