From 2e3e3271900097c3a0740b017d33ed019053e40c Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:14:35 +1000 Subject: [PATCH 1/7] Added error message support --- neofetch | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 0f7fdb76..659851d9 100755 --- a/neofetch +++ b/neofetch @@ -1890,6 +1890,9 @@ getwallpaper () { # If img is an xml file don't use it. [ "${img/*\./}" == "xml" ] && img="" + + [ -z "$img" ] && \ + err "Wallpaper detection failed, falling back to ascii mode." } # }}} @@ -1898,6 +1901,9 @@ getwallpaper () { getascii () { if [ ! -f "$ascii" ] || [ "$ascii" == "distro" ]; then + # Error message + [ ! -f "$ascii" ] && err "Ascii file not found, using distro ascii" + # Lowercase the distro name if [ "$version" -le 3 ]; then ascii=$(tr '[:upper:]' '[:lower:]' <<< "$ascii_distro") @@ -1921,6 +1927,7 @@ getascii () { if [ ! -f "$script_dir/ascii/distro/${ascii/ *}" ]; then padding="\033[0C" image="off" + err "Ascii file not found, falling back to text mode." return fi @@ -2008,6 +2015,11 @@ getimage () { if [ ! -f "$img" ] || [ ${#term_size} -le 5 ]; then image="ascii" getascii + + # Error messages + [ ! -f "$img" ] && err "\$img, isn't a file, falling back to ascii mode." + [ ${#term_size} -le 5 ] && err "Your terminal doesn't support \\\033[14t, falling back to ascii mode." + return fi @@ -2141,6 +2153,7 @@ getw3m_img_path () { else image="ascii" + err "w3m-img wasn't found on your system, falling back to ascii mode." fi } @@ -2582,6 +2595,9 @@ kdeconfigdir () { # }}} +err () { + err+="$(color 1)[!]$(color fg) $1 \n" +} # }}} @@ -2891,7 +2907,8 @@ while [ "$1" ]; do } ;; - --verbose) set -x ;; + -v) verbose="on" ;; + -vv) set -x; verbose="on" ;; --help) usage ;; esac @@ -2983,4 +3000,7 @@ if [ "$scrot" == "on" ]; then takescrot fi +# Show error messages +[ "$verbose" == "on" ] && printf "$err" + # }}} From 6e288c07897f621440a64977a111c3d2d27c6534 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:16:38 +1000 Subject: [PATCH 2/7] Cleanup --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 659851d9..59ddcf40 100755 --- a/neofetch +++ b/neofetch @@ -1891,8 +1891,8 @@ getwallpaper () { # If img is an xml file don't use it. [ "${img/*\./}" == "xml" ] && img="" - [ -z "$img" ] && \ - err "Wallpaper detection failed, falling back to ascii mode." + # Error msg + [ -z "$img" ] && err "Wallpaper detection failed, falling back to ascii mode." } # }}} From 40eae873578a0ca1fe782b608afe3cf9738e3d46 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:17:16 +1000 Subject: [PATCH 3/7] Update issue template --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 98617bc3..520c08f1 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -16,7 +16,7 @@ **Neofetch 1.7** -2. Run `neofetch --verbose 2> neofetchlog` +2. Run `neofetch -vv 2> neofetchlog` 3. Upload the contents of `neofetchlog` to pastebin, gist or equivalent. From 2c6a95b63fd697fd6e0eb7590f4a358fc16d347d Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:22:26 +1000 Subject: [PATCH 4/7] Fixed bug with error message and changelog --- 1.7.md | 13 +++++++++++-- neofetch | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/1.7.md b/1.7.md index 42f906ab..ff5310f5 100644 --- a/1.7.md +++ b/1.7.md @@ -11,10 +11,19 @@ Thanks to the following people for contributing this release. ### General - Made it easier to get verbose logs. -- Added `--verbose` to print a verbose log to stdout. \[1\] - Added issue template for github. -\[1\] Use `neofetch --verbose 2> file` to save a verbose log for bug reporting. +### Error Messages + +Neofetch now supports displaying error messages and saving a verbose log for
+troubleshooting. + +![log](https://ipfs.pics/ipfs/QmeTWGKozY79zcxbrgXueyTRfQcTUe7ZmDqLv4ASgJB4G4) + +- Added `-v` to print error messages to stdout. +- Added `-vv` to print a verbose log to stdout. \[1\] + +\[1\] Use `neofetch -vv 2> file` to save a verbose log for bug reporting. ### Info diff --git a/neofetch b/neofetch index 59ddcf40..1cefea04 100755 --- a/neofetch +++ b/neofetch @@ -1902,6 +1902,7 @@ getwallpaper () { getascii () { if [ ! -f "$ascii" ] || [ "$ascii" == "distro" ]; then # Error message + [ "$ascii" != "distro" ] && \ [ ! -f "$ascii" ] && err "Ascii file not found, using distro ascii" # Lowercase the distro name From 059a46619511282d66d762789002381e5f22c286 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:23:54 +1000 Subject: [PATCH 5/7] issue template --- .github/ISSUE_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 520c08f1..d137bf09 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,6 +6,8 @@ #### Operating system +## Image (If relevant) + ## Verbose log **Neofetch 1.6** From 9a0c126d3348de781e76bcfa57862fdbc787b304 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:27:24 +1000 Subject: [PATCH 6/7] Fix exit status --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 1cefea04..fb8155b6 100755 --- a/neofetch +++ b/neofetch @@ -3002,6 +3002,8 @@ if [ "$scrot" == "on" ]; then fi # Show error messages -[ "$verbose" == "on" ] && printf "$err" +if [ "$verbose" == "on" ]; then + printf "$err" +fi # }}} From c26e8a3de14bd44260449c2145a52695c83d58b5 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 24 Apr 2016 14:30:10 +1000 Subject: [PATCH 7/7] issue template --- .github/ISSUE_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index d137bf09..dddfe9c4 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,7 +6,7 @@ #### Operating system -## Image (If relevant) +## Screenshot (If relevant) ## Verbose log