-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (21 loc) · 902 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var participants = require("./participants");
var badgePrint = require('./badgePrint');
var fs = require('fs');
var moment = require('moment');
var argv = require('yargs')
.usage('Usage: $0 --file [string] --programData [file] --category [Attendee,Trainee,Crew,Speaker] --date [31.01.2017]')
.argv;
var category = argv.category || 'Attendee'
var startingDate = argv.date || null
var file = argv.file || null
var programData = null
if (argv.programData) {
programData = JSON.parse(fs.readFileSync(argv.programData, 'utf8'));
}
// Delete 102, 200, 119
if (!argv.file) {
console.log('Only blank badges will be printed. Usage: $0 --file [string]');
badgePrint.blankBadgePrint(10, '5-blank-badges-' + category + '.pdf', category);
} else {
badgePrint.badgePrint(participants(argv.file, category, moment(startingDate, "DD.MM.YYYY"), programData), 'badges-' + category + '.pdf');
}