screenfetch: warn if uploading was enabled and curl is missing

This commit is contained in:
Marshall Banana 2016-03-09 12:41:27 +01:00
parent 2ca5684093
commit b0435cd32b
2 changed files with 19 additions and 6 deletions

View File

@ -17,7 +17,7 @@ source=(https://github.com/KittyKatt/${_pkgname}/archive/v${pkgver}.tar.gz
screenshot.patch)
sha256sums=('6711fe924833919d53c1dfbbb43f3777d33e20357a1b1536c4472f6a1b3c6be0'
'647e86f8c02ed015ec03ce566b912da76620da18fabdd36edaf86f7ad7c759c6'
'26215ce8484897059943a26cc5b039243df7882b1ac741df4c2def2e6edb7c66')
'ab51f912efa8ae44847c9c1137f8f9181a8ecc942824d78b328d5afe200a299d')
prepare() {
cd "${srcdir}/${_pkgname}-${pkgver}"

View File

@ -1,5 +1,6 @@
Make it possible to upload screenshot when a custom screenshot command was used.
Print a warning if no custom command was given and scrot is missing.
Make it possible to upload screenshots when a custom screenshot command was used.
Warn if no custom command was given and scrot is missing.
Warn if uploading was enabled and curl is missing.
--- a/screenfetch-dev
+++ b/screenfetch-dev
@ -16,7 +17,7 @@ Print a warning if no custom command was given and scrot is missing.
printf " ${bold}-c string${c0} You may change the outputted colors with -c. The format is\n"
printf " as follows: [0-9][0-9],[0-9][0-9]. The first argument controls the\n"
printf " ASCII logo colors and the label colors. The second argument\n"
@@ -2053,7 +2053,15 @@
@@ -2053,8 +2053,19 @@
#######################
takeShot () {
@ -30,9 +31,13 @@ Print a warning if no custom command was given and scrot is missing.
+ fi
+ if [[ "${take_screenshot}" == "yes" ]]; then
if [[ "${upload}" == "1" ]]; then
+ if ! type -p curl >/dev/null 2>&1; then
+ errorOut "Cannot upload screenshot! \`curl' not in \$PATH"
+ else
shotfiles[1]=${shotfile}
if [ "$distro" == "Mac OS X" ]; then
@@ -2063,7 +2071,7 @@
displays="$(system_profiler SPDisplaysDataType | grep 'Resolution:' | wc -l | tr -d ' ')"
@@ -2063,7 +2074,7 @@
shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")"
done
printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null
@ -41,7 +46,15 @@ Print a warning if no custom command was given and scrot is missing.
if [ -f "${shotfile}" ]; then
verboseOut "Screenshot saved at '${shotfiles[@]}'"
printf "${bold}==>${c0} Uploading your screenshot now..."
@@ -2129,15 +2137,13 @@
@@ -2120,6 +2131,7 @@
else
errorOut "ERROR: Problem saving screenshot to ${shotfiles[@]}"
fi
+ fi
else
shotfiles[1]=${shotfile}
if [ "$distro" == "Mac OS X" ]; then
@@ -2129,15 +2141,13 @@
shotfiles[$i]="$(echo ${shotfile} | sed "s/\(.*\)\./\1_${i}./")"
done
printf "Taking shot in 3.. "; sleep 1; printf "2.. "; sleep 1; printf "1.. "; sleep 1; printf "0.\n"; screencapture -x ${shotfiles[@]} &> /dev/null