Skip to content

Commit 1830a7d

Browse files
committed
include JSON.sh as a git submodule
- easier to update from upstream and also includes its license file) - move push-exitcode.sh to the same helpers subfolder as JSON.sh - move set -e further down in pushbullet-bash - give an error message if JSON.sh has not been checked out
1 parent 0697370 commit 1830a7d

5 files changed

Lines changed: 16 additions & 195 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "helpers/JSON.sh"]
2+
path = helpers/JSON.sh
3+
url = https://github.com/dominictarr/JSON.sh.git

JSON.sh

Lines changed: 0 additions & 190 deletions
This file was deleted.

JSON.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
helpers/JSON.sh/JSON.sh

helpers/JSON.sh

Submodule JSON.sh added at 2de4579

pushbullet

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#! /bin/bash
22

3-
# avoid "EXPECTED value GOT EOF" errors when no pushes are returned
4-
set -e
5-
63
# Bash interface to the PushBullet api.
74
# Author: Red5d - https://github.com/Red5d
85

@@ -26,11 +23,17 @@ err() {
2623
}
2724

2825
if [ ! "$(which curl)" ]; then
29-
err "pushbullet-bash requires curl to run. Please install curl"
26+
err "pushbullet-bash requires curl to run. Please install curl."
3027
exit 1
3128
fi
3229

33-
# override default PB_CONFIG if different file or API key has been given
30+
if [ ! -e "$PROGDIR"/JSON.sh ]; then
31+
err "Not all required libraries are installed. Please change into the pushbullet-bash folder and run the following command:"
32+
err "git submodule init && git submodule update"
33+
exit
34+
fi
35+
36+
# use default PB_CONFIG if no different file or API key has been given
3437
if [[ ! -n "$PB_CONFIG" ]] && [[ ! -n "$PB_API_KEY" ]]; then
3538
PB_CONFIG=~/.config/pushbullet
3639
fi
@@ -42,6 +45,9 @@ if [[ -z "$PB_API_KEY" ]] && [[ "$1" != "setup" ]]; then
4245
exit 1
4346
fi
4447

48+
# from here on set -e to avoid "EXPECTED value GOT EOF" errors from JSON.sh when no pushes are returned
49+
set -e
50+
4551
printUsage() {
4652
echo "Usage: pushbullet [-q|--quiet|-d|--debug] <action> <device> <type> <data>
4753

0 commit comments

Comments
 (0)