-
Notifications
You must be signed in to change notification settings - Fork 0
/
icat
43 lines (39 loc) · 1.54 KB
/
icat
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
#!/bin/sh
if [ -z "$1" ]
then
echo "usage: icat [file ... | -settings | -version] [-s] [-c] [-i] [x1.5 | x2]"
echo "\t -s: sharpen image"
echo "\t -c: apply contour filter"
echo "\t -i: invert image"
echo "\t x1.5: prints image 1.5x larger than the default size."
echo "\t x2: prints image 2x larger than the default size."
echo "\t -settings: changes the settings of ICat."
echo "\t -version: Displays the installed ICat version."
elif [[ $1 = "-settings" ]]
then
while true; do
read -p "Is your terminal font wide where this character, '▓' appears as a square? [y|n] " yn
case $yn in
[Yy]* ) line1="font_width: full"; break;;
[Nn]* ) line1="font_width: half"; break;;
* ) echo "Please enter 'y' or 'n'.";;
esac
done
while true; do
read -p "Is your terminal background light or dark? [l|d] " ld
case $ld in
[Ll]* ) line2="terminal_color: light"; break;;
[Dd]* ) line2="terminal_color: dark"; break;;
* ) echo "Please enter 'l' or 'd'.";;
esac
done
echo "$line1" | sudo tee /usr/local/bin/icat_settings.cfg;
echo "$line2" | sudo tee -a /usr/local/bin/icat_settings.cfg;
elif [[ $1 = "-version" ]]
then
echo "v1.2.0";
else
# The pwd in the first arg must be prepended since this bash script is ran outside of the pwd.
# The '0' prepended to the args ensures that 5 args will always be passed to icat.py
python3 /usr/local/bin/icat.py "$(pwd)""/$1" "0$2" "0$3" "0$4" "0$5"
fi