Commit Diff


commit - de9fb1cd473b1a3a8044dcfe6ee7e774c8971f4a
commit + 94dc286d2e769172bcf054741a919a344ae1c2aa
blob - 6297c433590b0bfe34270619bda6a8a6e33ce33a
blob + 5f5dbbe6d82ba0cd7963cda5e03d351b43dbf85e
--- pushover.pl
+++ pushover.pl
@@ -27,16 +27,18 @@ GetOptions(
 	"message=s" => \(my $MESSAGE),
 	"title=s" => \(my $TITLE = "Notification"),
 	"priority=i" => \(my $PRIORITY = 0),
-	"config=s" => \(my $CONFIG),
+	"url=s" => \(my $URL),
 	"application=s" => \(my $APPLICATION = '_'),
+	"config=s" => \(my $CONFIG),
 );
 
 my $USAGE = <<"END_USAGE";
-Usage: $0 -m message [-t title] [-p priority] [-a application] [-c config]
+Usage: $0 -m message [-t title] [-p priority] [-u url] [-a application] [-c config]
 Options:
 -m | --message		text
 -t | --title		text | (default: Notification)
 -p | --priority		[0|1] (default: 0)
+-u | --url		text (no default)
 -a | --application	text (default: root property of config)
 -c | --config		text (no default)
 END_USAGE
@@ -51,6 +53,8 @@ my $http = HTTP::Tiny->new;
 my %HEADERS = ("Content-Type" => "application/json");
 my $uri = "https://api.pushover.net/1/messages.json";
 my $request = HTTP::Tiny->new('default_headers' => \%HEADERS);
-my $body = JSON::PP->new->encode({token => "$TOKEN", user => "$USER", title => "$TITLE", message => "$MESSAGE", priority => "$PRIORITY"});
+my $json = {token => "$TOKEN", user => "$USER", title => "$TITLE", message => "$MESSAGE", priority => "$PRIORITY"};
+$json->{'url'} = $URL if $URL;
+my $body = JSON::PP->new->encode($json);
 my $response = $request->post($uri, {'content' => $body});
 print "Pushover: $response->{'status'} $response->{'reason'}\n";