Permalink
Browse files

Add command register

  • Loading branch information...
lgaticaq committed Apr 27, 2016
1 parent 68652cc commit 07d5c4afc2b9c6ac8faa4ada5e2660d0a08e069a
Showing with 26 additions and 0 deletions.
  1. +1 −0 README.md
  2. +21 −0 src/beerjs-register.js
  3. +4 −0 src/beerjs.js
@@ -19,6 +19,7 @@ npm i -g beerjs-cli
```bash
beerjs info
beerjs events
beerjs register
```
## Example
@@ -0,0 +1,21 @@
#!/usr/bin/env node
'use strict';
import program from 'commander';
import beerjs from 'beerjs-info';
import logo from './ascii-logo';
import open from 'open';
program
.parse(process.argv);
beerjs.getRegister().then((data) => {
console.log(logo);
if (data !== null) {
console.log(`Abriendo el enlace ${data} en tu navegador...`);
open(data);
} else {
console.log('Lo sentimos, no hay cupos disponibles');
}
}).catch(() => console.log('Evento no encontrado'));
@@ -5,12 +5,16 @@
import program from 'commander';
import pkg from '../package.json';
import logo from './ascii-logo';
import updateNotifier from 'update-notifier';
updateNotifier({pkg}).notify();
program
.version(pkg.version)
.description('CLI get info of Beerjs')
.command('info', 'obtener información del próximo evento')
.command('events', 'obtener información de eventos previos')
.command('register', 'ir al sitio a registrarse al evento')
.parse(process.argv);
if (program.args.length === 0) {

0 comments on commit 07d5c4a

Please sign in to comment.