UNPKG

1.63 kBJavaScriptView Raw
1#! /usr/bin/env node
2
3var open = require('open'),
4 JnnData = require('./lib'),
5 program = require('commander'),
6 asciify = require('asciify'),
7 path = require('path'),
8 pkg = require( path.join(__dirname, 'package.json') ),
9 nextMeeting;
10
11program
12 .version(pkg.version)
13 .option('-d, --details', 'More details about the meetup')
14 .option('-m, --map', 'Google Map to Meetup location')
15 .option('-l, --link', 'Open the home page url')
16 .option('-a, --address', 'Show the venue address')
17 .option('-e, --easteregg', 'Tell you friends to \'jnn -e\' LoL!')
18 .parse(process.argv);
19
20JnnData.getNextMeeting(function (nextMeeting) {
21 asciify('JaxNode', {font:'larry3d', color: 'green'}, function(err, res){
22 console.log(res);
23
24 var mapurl = 'https://www.google.com/maps/place/' + nextMeeting.meeting.venue.name + '/@' + nextMeeting.meeting.venue.lat + ',' + nextMeeting.meeting.venue.lon + 'z18';
25 var meetingText = 'The next JaxNode meeting will be on ' + nextMeeting.meeting.time + ' at ' + nextMeeting.meeting.venue.name;
26
27 console.log(meetingText);
28
29 if (program.details) {
30 console.log(nextMeeting.meeting.name + ':' + nextMeeting.meeting.description);
31 }
32 if (program.map) {
33 open(mapurl);
34 }
35 if (program.link) {
36 open('http://www.jaxnode.com');
37 }
38 if (program.address) {
39 console.log(nextMeeting.meeting.venue.name);
40 console.log(nextMeeting.meeting.venue.address_1);
41 console.log(nextMeeting.meeting.venue.city + ', ' + nextMeeting.meeting.venue.state);
42 }
43 if (program.easteregg) {
44 open('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
45 }
46 });
47});
48