diff --git a/lib/utils.js b/lib/utils.js index fe4b164..862d2d4 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -42,6 +42,7 @@ const notifySendFlags = { c: 'category', category: 'category', subtitle: 'category', + action: 'action', h: 'hint', hint: 'hint', a: 'app-name', @@ -56,14 +57,13 @@ module.exports.command = function (notifier, options, cb) { console.info('[notifier options]', options.join(' ')); } - return cp.exec(notifier + ' ' + options.join(' '), function ( - error, - stdout, - stderr - ) { - if (error) return cb(error); - cb(stderr, stdout); - }); + return cp.exec( + notifier + ' ' + options.join(' '), + function (error, stdout, stderr) { + if (error) return cb(error); + cb(stderr, stdout); + } + ); }; module.exports.fileCommand = function (notifier, options, cb) { diff --git a/notifiers/notifysend.js b/notifiers/notifysend.js index 68dfbf6..a565e1c 100644 --- a/notifiers/notifysend.js +++ b/notifiers/notifysend.js @@ -73,13 +73,21 @@ function notifyRaw(options, callback) { } Object.defineProperty(NotifySend.prototype, 'notify', { - get: function() { + get: function () { if (!this._notify) this._notify = notifyRaw.bind(this); return this._notify; } }); -const allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint', 'app-name']; +const allowedArguments = [ + 'urgency', + 'expire-time', + 'icon', + 'category', + 'hint', + 'app-name', + 'action' +]; function doNotification(options, callback) { options = utils.mapToNotifySend(options); diff --git a/test/notify-send.js b/test/notify-send.js index 190fbfa..8154582 100644 --- a/test/notify-send.js +++ b/test/notify-send.js @@ -116,6 +116,8 @@ describe('notify-send', function () { '"body"', '--icon', '"icon-string"', + '--action', + '"action_type"', '--expire-time', '"1000"' ]; @@ -127,6 +129,7 @@ describe('notify-send', function () { message: 'body', icon: 'icon-string', time: 1, + action: 'action_type', tullball: 'notValid' }); });