# shellcheck shell=dash disable=SC2016

# x font nerd install firacode
# x font i nerd/firacode
# x font i firacode -> nerd

xrc:mod:lib  font     nerd/install  nerd/ls  nerd/info

___x_cmd_font_nerd(){
    [ $# -gt 0 ]    ||  set -- ls

    local op="$1";      shift
    case "$op" in
        -h|--help)        ___x_cmd help -m font nerd  "$@" ;;
        i|install)        ___x_cmd_font_nerd_install  "$@" ;;
        preview|ls|info)  ___x_cmd_font_nerd_"$op"    "$@" ;;
    esac
}

___x_cmd_font_nerd_preview(){
    local X_help_cmd=""; X_help_cmd='x help -m font nerd preview' help:arg:parse

    if [ -n "$1" ]; then
        local hash=""
        hash="$(___x_cmd_font_nerd___tsv_raw | ___x_cmd_cmds awk -v FS="\t" -v name="$1" '$1 == name { print $5 }')"
        ___x_cmd open "https://www.programmingfonts.org/#${hash}"
    else
        ___x_cmd open "https://www.nerdfonts.com/font-downloads"
    fi
}
