#!/data/data/com.termux/files/usr/bin/bash

##==========[Start Of Function]==========##
show_help() {
    echo -e "Termux Fonts
Usage: termux-fonts [command]
                    [options]
Command:
        change        : Change termux font
        reset         : Reset termux font to default

Options:
        -h, --help    : Show this help
        -v, --version : Show the Version

You can add font to \$HOME/.fonts folder and remove .ttf extension

for more info visit: https://github.com/ArieSR91
"
}

show_version() {
    echo "1.2.0-SR"
}

change_font() {
    echo -e "Termux Fonts"
    files=$(ls -1 $PREFIX/share/fonts/TTF | cut -d '.' -f1)
    select choice in ${files[@]}; do
        break
    done
    echo "Setting up ${choice} fonts"
    cp $PREFIX/share/fonts/TTF/${choice}.ttf $HOME/.termux/font.ttf
    termux-reload-settings
}

reset_font() {
    rm $HOME/.termux/font.ttf
    termux-reload-settings
}
##==========[End Of Function]==========##

case $1 in
    -h | --help)
        show_help
        ;;
    -v | --version)
        show_version
        ;;
    change)
        change_font
        ;;
    reset)
        reset_font
        ;;
    *)
        show_help
        ;;
esac
