├── osx ├── terminal-notifier-fail.app │ └── Contents │ │ ├── PkgInfo │ │ ├── Resources │ │ ├── Failed.icns │ │ └── en.lproj │ │ │ ├── MainMenu.nib │ │ │ ├── InfoPlist.strings │ │ │ └── Credits.rtf │ │ ├── MacOS │ │ └── terminal-notifier │ │ ├── _CodeSignature │ │ └── CodeResources │ │ └── Info.plist ├── terminal-notifier-info.app │ └── Contents │ │ ├── PkgInfo │ │ ├── Resources │ │ ├── Notify.icns │ │ └── en.lproj │ │ │ ├── MainMenu.nib │ │ │ ├── InfoPlist.strings │ │ │ └── Credits.rtf │ │ ├── MacOS │ │ └── terminal-notifier │ │ ├── _CodeSignature │ │ └── CodeResources │ │ └── Info.plist └── terminal-notifier-pass.app │ └── Contents │ ├── PkgInfo │ ├── MacOS │ └── terminal-notifier │ ├── Resources │ ├── Success.icns │ └── en.lproj │ │ ├── MainMenu.nib │ │ ├── InfoPlist.strings │ │ └── Credits.rtf │ ├── _CodeSignature │ └── CodeResources │ └── Info.plist ├── doc └── screenshots │ ├── fail.png │ ├── info.png │ └── pass.png ├── package.json ├── index.js ├── bin └── osx-notifier.js └── README.md /osx/terminal-notifier-fail.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /doc/screenshots/fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/doc/screenshots/fail.png -------------------------------------------------------------------------------- /doc/screenshots/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/doc/screenshots/info.png -------------------------------------------------------------------------------- /doc/screenshots/pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/doc/screenshots/pass.png -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/Resources/Failed.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-fail.app/Contents/Resources/Failed.icns -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/Resources/Notify.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-info.app/Contents/Resources/Notify.icns -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/MacOS/terminal-notifier: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-fail.app/Contents/MacOS/terminal-notifier -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/MacOS/terminal-notifier: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-info.app/Contents/MacOS/terminal-notifier -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/MacOS/terminal-notifier: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-pass.app/Contents/MacOS/terminal-notifier -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/Resources/Success.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-pass.app/Contents/Resources/Success.icns -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/Resources/en.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-fail.app/Contents/Resources/en.lproj/MainMenu.nib -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/Resources/en.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-info.app/Contents/Resources/en.lproj/MainMenu.nib -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/Resources/en.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-pass.app/Contents/Resources/en.lproj/MainMenu.nib -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-fail.app/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-info.app/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chbrown/osx-notifier/HEAD/osx/terminal-notifier-pass.app/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/Resources/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/Resources/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/Resources/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "osx-notifier", 3 | "description": "Send notifications to the OS X Notification Center using terminal-notifier.app", 4 | "version": "0.2.2", 5 | "homepage": "https://github.com/chbrown/osx-notifier", 6 | "author": "Christopher Brown (http://henrian.com)", 7 | "keywords": [ 8 | "osx", 9 | "notification center", 10 | "notify", 11 | "growl" 12 | ], 13 | "contributors": [ 14 | "Jonathan Azoff (http://azoffdesign.com)", 15 | "Christopher Brown (http://henrian.com)" 16 | ], 17 | "dependencies": { 18 | "optimist": "*" 19 | }, 20 | "bugs": "https://github.com/chbrown/osx-notifier/issues", 21 | "repository": { 22 | "type": "git", 23 | "url": "git://github.com/chbrown/osx-notifier.git" 24 | }, 25 | "license": "MIT", 26 | "preferGlobal": "true", 27 | "bin": { 28 | "osx-notifier": "bin/osx-notifier.js" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var child_process = require('child_process'); 3 | 4 | var cli_args = [ 5 | 'title', 6 | 'subtitle', 7 | 'message', 8 | 'group', 9 | 'remove', 10 | 'list', 11 | 'activate', 12 | 'open', 13 | 'execute', 14 | ]; 15 | 16 | /** escape any existing double quotes in value and then wrap in double quotes */ 17 | function escapeArgument(value) { 18 | return '"' + value.replace(/"/g, '\\"') + '"'; 19 | } 20 | 21 | module.exports = function(opts) { 22 | var app = 'terminal-notifier-' + opts.type + '.app'; 23 | var file = path.join(__dirname, 'osx', app, 'Contents', 'MacOS', 'terminal-notifier'); 24 | var args = []; 25 | cli_args.forEach(function(arg) { 26 | if (opts[arg]) args.push('-' + arg, escapeArgument(opts[arg])); 27 | }); 28 | 29 | if (opts.verbose) { 30 | console.log(file, args); 31 | } 32 | child_process.execFile(file, args, {}, function(err, stdout, stderr) { 33 | if (err) { 34 | console.error('execFile(' + file + ')'); 35 | if (stdout) { 36 | console.log(stdout); 37 | } 38 | if (stderr) { 39 | console.error(stderr); 40 | } 41 | throw err; 42 | } 43 | else { 44 | if (stdout && opts.verbose) { 45 | console.log(stdout); 46 | } 47 | if (stderr && opts.verbose) { 48 | console.error(stderr); 49 | } 50 | } 51 | }); 52 | }; 53 | -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/Failed.icns 8 | 9 | 5PTHyCZ2DVpqH9uT1YhHCjnGTLM= 10 | 11 | Resources/en.lproj/Credits.rtf 12 | 13 | hash 14 | 15 | YKJIFIsxneJuNkJNJQIcJIjiPOg= 16 | 17 | optional 18 | 19 | 20 | Resources/en.lproj/InfoPlist.strings 21 | 22 | hash 23 | 24 | MiLKDDnrUKr4EmuvhS5VQwxHGK8= 25 | 26 | optional 27 | 28 | 29 | Resources/en.lproj/MainMenu.nib 30 | 31 | hash 32 | 33 | N1QqAM17vgDk7XNtv27koaE4IhE= 34 | 35 | optional 36 | 37 | 38 | 39 | rules 40 | 41 | ^Resources/ 42 | 43 | ^Resources/.*\.lproj/ 44 | 45 | optional 46 | 47 | weight 48 | 1000 49 | 50 | ^Resources/.*\.lproj/locversion.plist$ 51 | 52 | omit 53 | 54 | weight 55 | 1100 56 | 57 | ^version.plist$ 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/Notify.icns 8 | 9 | KcJRIuj13j1C56RrHQi7g7sxcr8= 10 | 11 | Resources/en.lproj/Credits.rtf 12 | 13 | hash 14 | 15 | YKJIFIsxneJuNkJNJQIcJIjiPOg= 16 | 17 | optional 18 | 19 | 20 | Resources/en.lproj/InfoPlist.strings 21 | 22 | hash 23 | 24 | MiLKDDnrUKr4EmuvhS5VQwxHGK8= 25 | 26 | optional 27 | 28 | 29 | Resources/en.lproj/MainMenu.nib 30 | 31 | hash 32 | 33 | N1QqAM17vgDk7XNtv27koaE4IhE= 34 | 35 | optional 36 | 37 | 38 | 39 | rules 40 | 41 | ^Resources/ 42 | 43 | ^Resources/.*\.lproj/ 44 | 45 | optional 46 | 47 | weight 48 | 1000 49 | 50 | ^Resources/.*\.lproj/locversion.plist$ 51 | 52 | omit 53 | 54 | weight 55 | 1100 56 | 57 | ^version.plist$ 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Resources/Success.icns 8 | 9 | 78sPBudKpASNEPzsDGG9KML1+uw= 10 | 11 | Resources/en.lproj/Credits.rtf 12 | 13 | hash 14 | 15 | YKJIFIsxneJuNkJNJQIcJIjiPOg= 16 | 17 | optional 18 | 19 | 20 | Resources/en.lproj/InfoPlist.strings 21 | 22 | hash 23 | 24 | MiLKDDnrUKr4EmuvhS5VQwxHGK8= 25 | 26 | optional 27 | 28 | 29 | Resources/en.lproj/MainMenu.nib 30 | 31 | hash 32 | 33 | N1QqAM17vgDk7XNtv27koaE4IhE= 34 | 35 | optional 36 | 37 | 38 | 39 | rules 40 | 41 | ^Resources/ 42 | 43 | ^Resources/.*\.lproj/ 44 | 45 | optional 46 | 47 | weight 48 | 1000 49 | 50 | ^Resources/.*\.lproj/locversion.plist$ 51 | 52 | omit 53 | 54 | weight 55 | 1100 56 | 57 | ^version.plist$ 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /osx/terminal-notifier-fail.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 12A269 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | terminal-notifier 11 | CFBundleIconFile 12 | Failed 13 | CFBundleIdentifier 14 | nl.superalloy.oss.failed.terminal-notifier 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | terminal-notifier 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.5.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 7 27 | DTCompiler 28 | 29 | DTPlatformBuild 30 | 4F1003 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 12A264 35 | DTSDKName 36 | macosx10.8 37 | DTXcode 38 | 0441 39 | DTXcodeBuild 40 | 4F1003 41 | LSMinimumSystemVersion 42 | 10.8 43 | LSUIElement 44 | 45 | NSHumanReadableCopyright 46 | Copyright © 2012 Eloy Durán. All rights reserved. 47 | NSMainNibFile 48 | MainMenu 49 | NSPrincipalClass 50 | NSApplication 51 | 52 | 53 | -------------------------------------------------------------------------------- /osx/terminal-notifier-info.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 12A269 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | terminal-notifier 11 | CFBundleIconFile 12 | Notify 13 | CFBundleIdentifier 14 | nl.superalloy.oss.notify.terminal-notifier 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | terminal-notifier 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.5.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 7 27 | DTCompiler 28 | 29 | DTPlatformBuild 30 | 4F1003 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 12A264 35 | DTSDKName 36 | macosx10.8 37 | DTXcode 38 | 0441 39 | DTXcodeBuild 40 | 4F1003 41 | LSMinimumSystemVersion 42 | 10.8 43 | LSUIElement 44 | 45 | NSHumanReadableCopyright 46 | Copyright © 2012 Eloy Durán. All rights reserved. 47 | NSMainNibFile 48 | MainMenu 49 | NSPrincipalClass 50 | NSApplication 51 | 52 | 53 | -------------------------------------------------------------------------------- /osx/terminal-notifier-pass.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 12A269 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | terminal-notifier 11 | CFBundleIconFile 12 | Success 13 | CFBundleIdentifier 14 | nl.superalloy.oss.success.terminal-notifier 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | terminal-notifier 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.5.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 7 27 | DTCompiler 28 | 29 | DTPlatformBuild 30 | 4F1003 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 12A264 35 | DTSDKName 36 | macosx10.8 37 | DTXcode 38 | 0441 39 | DTXcodeBuild 40 | 4F1003 41 | LSMinimumSystemVersion 42 | 10.8 43 | LSUIElement 44 | 45 | NSHumanReadableCopyright 46 | Copyright © 2012 Eloy Durán. All rights reserved. 47 | NSMainNibFile 48 | MainMenu 49 | NSPrincipalClass 50 | NSApplication 51 | 52 | 53 | -------------------------------------------------------------------------------- /bin/osx-notifier.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var optimist = require('optimist'); 3 | var notify = require('..'); 4 | 5 | var basic = optimist.boolean(['help', 'verbose', 'version']); 6 | var argv = basic.argv; 7 | 8 | var full = basic 9 | .usage('Usage: osx-notifier [options]') 10 | .describe({ 11 | type: 'type of icon to show; one of "info", "fail", or "pass"', 12 | title: 'title of the notification', 13 | subtitle: 'subtitle of the notification', 14 | message: 'message body of the notification', 15 | group: 'replace and be replaced by any notifications of the same group', 16 | remove: 'remove any notifications previously posted with this group (or ALL groups)', 17 | list: 'list notifications previously posted with this group (or ALL groups)', 18 | activate: 'bundle identifier of an application to be activated if the user clicks the notification', 19 | open: 'open a url / file / custom url scheme if the user clicks the notification', 20 | execute: 'execute a shell command if the user clicks the notification', 21 | 22 | help: 'print this help message', 23 | verbose: 'print extra output', 24 | version: 'print version', 25 | }) 26 | .default({ 27 | type: 'info', 28 | title: 'Terminal', 29 | }) 30 | .demand('message'); 31 | 32 | if (argv.help) { 33 | full.showHelp(); 34 | process.exit(0); 35 | } 36 | 37 | if (argv.version) { 38 | var package_json = require('../package'); 39 | console.log(package_json.version); 40 | 41 | // var message = new Date().toString(); 42 | var message = __filename.replace(process.env.HOME, '~'); 43 | notify({ 44 | type: argv.type, 45 | title: 'OS X Notifier', 46 | subtitle: 'Version ' + package_json.version, 47 | message: message, 48 | group: 'osx-notifier', 49 | }); 50 | } 51 | else { 52 | argv = full.check(function(argv) { 53 | if (['fail', 'info', 'pass'].indexOf(argv.type) == -1) { 54 | throw new Error('Notification type "' + argv.type + '" is invalid'); 55 | } 56 | }).argv; 57 | 58 | notify(argv); 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # osx-notifier 2 | 3 | Reduction of [node-osx-notifier](https://github.com/azoff/node-osx-notifier) to drive from the command line or directly from another node.js script, instead of an [express](http://expressjs.com/) server. 4 | 5 | 6 | ## Command line install & usage 7 | 8 | ```bash 9 | npm install -g osx-notifier 10 | ``` 11 | 12 | **Usage** (`osx-notifier --help`): 13 | 14 | ```bash 15 | osx-notifier 16 | --type type of icon to show; 17 | one of "info", "fail", or "pass" [default: "info"] 18 | 19 | --title title of the notification [default: "Terminal"] 20 | --subtitle subtitle of the notification 21 | --message message body of the notification [required] 22 | 23 | --group replace and be replaced by any notifications of the same group 24 | 25 | --remove remove any notifications previously posted with this group 26 | (or ALL groups) 27 | 28 | --list list notifications previously posted with this group 29 | (or ALL groups) 30 | 31 | --activate bundle identifier of an application to be activated 32 | if the user clicks the notification 33 | 34 | --open open a url / file / custom url scheme 35 | if the user clicks the notification 36 | 37 | --execute execute a shell command 38 | if the user clicks the notification 39 | 40 | --help print this help message 41 | --verbose print extra output 42 | --version print version 43 | ``` 44 | 45 | 46 | ## API install & usage 47 | 48 | ```bash 49 | npm install osx-notifier 50 | ``` 51 | 52 | Or in your package.json: 53 | 54 | ```json 55 | { 56 | "dependencies": { 57 | "osx-notifier": "*" 58 | } 59 | } 60 | ``` 61 | 62 | **Usage**: 63 | 64 | ```javascript 65 | var notify = require('osx-notifier'); 66 | 67 | var duration = 45; 68 | notify({ 69 | type: 'pass', 70 | title: 'Taskdoer Report', 71 | subtitle: 'Task completed', 72 | message: 'Took ' + duration + ' seconds.', 73 | group: 'taskdoer', 74 | }); 75 | ``` 76 | 77 | 78 | ## --type 79 | 80 | The Mac OS X Notification Center can only be accessed via signed apps, 81 | and any message sent from an application must be accompanied by the icon for that application. 82 | 83 | Three variations on [terminal-notifier](https://github.com/alloy/terminal-notifier) are included with this app, 84 | which are accessed via the different `--type` options: 85 | 86 | | `--type` | sample | 87 | |:----:|:-----------| 88 | | `info` | ![info screenshot](https://raw.github.com/chbrown/osx-notifier/master/doc/screenshots/info.png) | 89 | | `pass` | ![pass screenshot](https://raw.github.com/chbrown/osx-notifier/master/doc/screenshots/pass.png) | 90 | | `fail` | ![fail screenshot](https://raw.github.com/chbrown/osx-notifier/master/doc/screenshots/fail.png) | 91 | 92 | 93 | ## Winston integration 94 | 95 | You can use this functionality from within [winston](https://github.com/flatiron/winston) (a popular logging library) as a "Transport" via my [`winston-notification-center`](https://github.com/chbrown/winston-notification-center) plugin package (available from npm). 96 | 97 | **Example:** 98 | 99 | ```javascript 100 | var winston = require('winston'); 101 | var NotificationCenterTransport = require('winston-notification-center'); 102 | winston.add(NotificationCenterTransport); 103 | winston.info('Hello world.'); 104 | ``` 105 | 106 | See the [winston-notification-center](https://github.com/chbrown/winston-notification-center) project page for more options. 107 | 108 | 109 | ## Credits 110 | 111 | Thanks to [azoff](https://github.com/azoff/node-osx-notifier) for the prebuilt apps and the screenshots, 112 | and to [alloy](https://github.com/alloy/terminal-notifier) for the great OS X application wrapper. 113 | 114 | 115 | ## License 116 | 117 | Copyright 2013 Christopher Brown. [MIT Licensed](http://chbrown.github.io/licenses/MIT/#2013). 118 | --------------------------------------------------------------------------------