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