Don't create the directory until we know we can use image mode and remove broken underline option

This commit is contained in:
Dylan 2016-01-31 16:25:11 +11:00
parent 3cfd88f574
commit c44da9511c
3 changed files with 4 additions and 15 deletions

View File

@ -231,7 +231,6 @@ alias fetch2="fetch \
--info_color num Change the color of the info --info_color num Change the color of the info
Text Formatting: Text Formatting:
--underline on/off Enable/Disable title underline
--underline_char char Character to use when underlineing title --underline_char char Character to use when underlineing title
--line_wrap on/off Enable/Disable line wrapping --line_wrap on/off Enable/Disable line wrapping
--bold on/off Enable/Disable bold text --bold on/off Enable/Disable bold text

View File

@ -177,10 +177,6 @@ line_wrap="on"
# --bold on/off # --bold on/off
bold="on" bold="on"
# Toggle title underline
# --underline on/off
underline="on"
# Underline character # Underline character
# --underline_char char # --underline_char char
underline_char="-" underline_char="-"

14
fetch
View File

@ -197,10 +197,6 @@ line_wrap="on"
# --bold on/off # --bold on/off
bold="on" bold="on"
# Toggle title underline
# --underline on/off
underline="on"
# Underline character # Underline character
# --underline_char char # --underline_char char
underline_char="-" underline_char="-"
@ -1561,9 +1557,6 @@ getimage () {
image="ascii" image="ascii"
fi fi
# Make the directory if it doesn't exist
mkdir -p "$imgtempdir"
# Image size is half of the terminal # Image size is half of the terminal
imgsize=$((columns * font_width / split_size)) imgsize=$((columns * font_width / split_size))
@ -1600,7 +1593,7 @@ getimage () {
;; ;;
esac esac
# If $img is empty, reset padding to 0 and exit the function # If $img is empty, fallback to ascii mode.
if [ ! -f "$img" ]; then if [ ! -f "$img" ]; then
# Fallback to ascii mode # Fallback to ascii mode
image="ascii" image="ascii"
@ -1612,6 +1605,9 @@ getimage () {
# Lines equals terminal height # Lines equals terminal height
lines=$(tput lines) lines=$(tput lines)
# Make the directory if it doesn't exist
mkdir -p "$imgtempdir"
# Check to see if the image has a file extension # Check to see if the image has a file extension
case "${img##*/}" in case "${img##*/}" in
*"."*) *"."*)
@ -1943,7 +1939,6 @@ usage () { cat << EOF
--info_color num Change the color of the info --info_color num Change the color of the info
Text Formatting: Text Formatting:
--underline on/off Enable/Disable title underline
--underline_char char Character to use when underlineing title --underline_char char Character to use when underlineing title
--line_wrap on/off Enable/Disable line wrapping --line_wrap on/off Enable/Disable line wrapping
--bold on/off Enable/Disable bold text --bold on/off Enable/Disable bold text
@ -2046,7 +2041,6 @@ while [ "$1" ]; do
--info_color) info_color=$2 ;; --info_color) info_color=$2 ;;
# Text Formatting # Text Formatting
--underline) underline="$2" ;;
--underline_char) underline_char="$2" ;; --underline_char) underline_char="$2" ;;
--line_wrap) line_wrap="$2" ;; --line_wrap) line_wrap="$2" ;;
--bold) bold="$2" ;; --bold) bold="$2" ;;