Ascii: Glob match ascii art
This commit is contained in:
parent
dfdc9977bd
commit
af97d1a645
1 changed files with 17 additions and 23 deletions
40
neofetch
40
neofetch
|
@ -20,7 +20,7 @@ export LANG=C
|
||||||
export PATH="/usr/sbin:/sbin:${PATH}"
|
export PATH="/usr/sbin:/sbin:${PATH}"
|
||||||
|
|
||||||
# Set no case match.
|
# Set no case match.
|
||||||
shopt -s nocasematch
|
shopt -s nocasematch nocaseglob
|
||||||
|
|
||||||
# Reset colors and bold.
|
# Reset colors and bold.
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
@ -1922,34 +1922,28 @@ get_ascii() {
|
||||||
[[ "$ascii" != "distro" && ! -f "$ascii" ]] && \
|
[[ "$ascii" != "distro" && ! -f "$ascii" ]] && \
|
||||||
err "Ascii: Ascii file not found, using distro ascii."
|
err "Ascii: Ascii file not found, using distro ascii."
|
||||||
|
|
||||||
# Lowercase the distro name so we can match it to a file.
|
# Find ascii art dir.
|
||||||
if (("$bash_version" <= 3)); then
|
if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then
|
||||||
ascii="$(tr '[:upper:]' '[:lower:]' <<< "$ascii_distro")"
|
ascii_dir="/usr/share/neofetch/ascii/distro"
|
||||||
else
|
|
||||||
ascii="${ascii_distro,,}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f "/usr/share/neofetch/ascii/distro/${ascii/ *}" ]]; then
|
elif [[ -d "/usr/local/share/neofetch/ascii/distro" ]]; then
|
||||||
ascii="/usr/share/neofetch/ascii/distro/${ascii/ *}"
|
ascii_dir="/usr/local/share/neofetch/ascii/distro"
|
||||||
|
|
||||||
elif [[ -f "/usr/local/share/neofetch/ascii/distro/${ascii/ *}" ]]; then
|
elif [[ -d "/data/data/com.termux/files/usr/share/neofetch/ascii/distro" ]]; then
|
||||||
ascii="/usr/local/share/neofetch/ascii/distro/${ascii/ *}"
|
ascii_dir="/data/data/com.termux/files/usr/share/neofetch/ascii/distro"
|
||||||
|
|
||||||
elif [[ -f "/data/data/com.termux/files/usr/share/neofetch/ascii/distro/${ascii/ *}" ]]; then
|
|
||||||
ascii="/data/data/com.termux/files/usr/share/neofetch/ascii/distro/${ascii/ *}"
|
|
||||||
|
|
||||||
else
|
else
|
||||||
get_script_dir 2>/dev/null
|
get_script_dir 2>/dev/null
|
||||||
|
ascii_dir="${script_dir}/ascii/distro"
|
||||||
# If the ascii file doesn't exist fallback to text mode.
|
|
||||||
if [[ -f "$script_dir/ascii/distro/${ascii/ *}" ]]; then
|
|
||||||
ascii="$script_dir/ascii/distro/${ascii/ *}"
|
|
||||||
|
|
||||||
else
|
|
||||||
to_off "Ascii: Ascii file not found, falling back to text mode."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove 'linux' from 'linux mint'.
|
||||||
|
[[ "$ascii_distro" =~ ^linux ]] && ascii_distro="${ascii_distro/linux }"
|
||||||
|
|
||||||
|
# ascii_dir/first_letter (example: 'ascii_dir/m'*)
|
||||||
|
for art in "${ascii_dir}/${ascii_distro:0:1}"*; do
|
||||||
|
[[ "$ascii_distro" =~ ${art/*\/} ]] && { ascii="$art"; break; }
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set locale to get correct padding.
|
# Set locale to get correct padding.
|
||||||
|
|
Loading…
Reference in a new issue