-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshowfigfonts.bat
66 lines (58 loc) · 1.57 KB
/
showfigfonts.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@rem showfigfonts for Windows by Sichen Lyu, 17 Jan 2024
@rem Based on the original showfigfonts script by Glenn Chappell <[email protected]>, 25 Aug 1994
@rem You can also see the original script under this directory (`showfigfonts`)
@rem
@rem Prints a list of available figlet fonts, along with a sample of each
@rem font. If directory is given, lists fonts in that directory; otherwise
@rem uses the default font directory. If word is given, prints that word
@rem in each font; otherwise prints the font name.
@rem
@rem Usage: showfigfonts [ -d directory ] [ word ]
@echo off
setlocal enabledelayedexpansion
set figlet_path="%~dp0figlet.exe"
set usage_msg=Usage: %~n0 [ -d directory ] [ word ]
set argc=0
for %%i in (%*) do set /a argc+=1
@rem count args
if "%1"=="-d" (
if %argc% gtr 3 (
echo %usage_msg%
exit 1
)
if %argc% lss 2 (
echo %usage_msg%
exit 1
)
set fontdir="%2"
if %argc% lss 3 (
goto:start_print
)
set word="%3"
) else (
for /f "delims=" %%i in ('%figlet_path% -I2') do set fontdir="%%i"
if not "!fontdir:~2,1!"==":" (
if not "!fontdir:~3,1!"=="\" (
set fontdir="%~dp0!fontdir!"
)
)
if %argc% lss 1 (
goto:start_print
)
set word="%1"
if %argc% gtr 1 (
echo %usage_msg%
exit 1
)
)
:start_print
for /r %fontdir% %%i in (*.flf) do (
echo %%~ni :
if not defined word (
call %figlet_path% -d %fontdir% -f "%%~ni" "%%~ni"
) else (
call %figlet_path% -d %fontdir% -f "%%~ni" "%word%"
)
echo.
)
endlocal