101st-ab-authoritypaper
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "101st-ab-authoritypaper", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Software for generating Authority Paper documents.", | ||
@@ -18,4 +18,4 @@ "main": "src/index.js", | ||
"bin": { | ||
"authoritypaper": "src/index.js" | ||
"authoritypaper": "src/index.js" | ||
} | ||
} |
@@ -13,6 +13,19 @@ #!/usr/bin/env node | ||
.option("to", {alias: "output", describe: "Output file location", type: "string", demandOption: true, default: __dirname + ".pdf" }) | ||
.option("dev", {alias: "test", describe: "Automatically fills in data", type: "boolean", demandOption: false }) | ||
.option("headless", {alias: "dev", describe: "Automatically fills in data", type: "boolean", demandOption: false }) | ||
.option("subjectname", {describe: "[Headless] Name of Subject", type: "string", default: "101stAirborneRanking", demandOption: false }) | ||
.option("subjectregiment", {describe: "[Headless] Regiment of Subject (Follow GUI options)", default: "506th Infantry Regiment", type: "string", demandOption: false }) | ||
.option("subjectrank", {describe: "[Headless] Rank of Subject (Abbreviation, Follow GUI options.)", default: "PFC", type: "string", demandOption: false }) | ||
.option("subjectunit", {describe: "[Headless] Unit of Subject (Abbreviation, Follow GUI options.)", default: "907th Infantry Battalion", type: "string", demandOption: false }) | ||
.option("subjectposition", {describe: "[Headless] Position of Subject (Abbreviation, Follow GUI options.)", default: "Battalion Commanding Officer", type: "string", demandOption: false }) | ||
.option("template", {describe: "[Headless] Template (Abbreviation, Follow GUI options.)", default: "bco", type: "string", demandOption: false }) | ||
.option("signatorname", {describe: "[Headless] Name of Signator", type: "string", default: "plainenglish", demandOption: false }) | ||
.option("signatorrank", {describe: "[Headless] Rank of Signator (Abbreviation, Follow GUI options.)", type: "string", default: "MSGT", demandOption: false }) | ||
.option("signatorunit", {describe: "[Headless] Unit of Signator (Abbreviation, Follow GUI options.)", type: "string", default: "506th HQ", demandOption: false }) | ||
.option("signatorposition", {describe: "[Headless] Position of Signator (Abbreviation, Follow GUI options.)", type: "string", default: "RSEA", demandOption: false }) | ||
.argv; | ||
console.log(Options); | ||
//console.log(Options); | ||
@@ -23,3 +36,3 @@ //// Details //// | ||
const RANK_CHOICES = ["PVT", "PFC", "CPL", "SGT", "SSGT", "FSGT", "MSGT", "2Lt", "Lt", "Capt", "Maj", "Lt Col", "Col", "Brig Gen", "Maj Gen", "Lt Gen", "Gen"]; | ||
const UNIT_CHOICES = ["Regiment Headquarters", "907th Infantry Battalion", "332nd Infantry Battalion", "Able Company", "Baker Company", "Easy Company", "Fox Company"]; | ||
const UNIT_CHOICES = ["907th Infantry Battalion", "332nd Infantry Battalion", "Able Company", "Baker Company", "Easy Company", "Fox Company", "468th Parachute Battalion", "377th Parachute Battalion", "Bandit Company", "Ape Company", "Paladin Company", "Juliett Company"]; | ||
@@ -33,7 +46,2 @@ const FONT = Path.join(__dirname, "fonts", "CutiveMono-Regular.ttf"); | ||
async function GeneratePDF() { | ||
}; | ||
(async () => { | ||
@@ -112,8 +120,9 @@ let Subject = {}; | ||
} else { | ||
Subject = {Name: "test_officer506", Regiment: "506th Infantry Regiment", Rank: "Lt Col", Unit: "332nd Infantry Battalion", Position: "Commanding Officer", Template: "BCO"}; | ||
Signator = {Name: "plainenglish", Rank: "MSGT", Unit: "506th HQ", Position: "RSEA"}; | ||
Subject = {Name: Options.subjectname, Regiment: Options.subjectregiment, Rank: Options.subjectrank, Unit: Options.subjectunit, Position: Options.subjectposition, Template: Options.template}; | ||
Signator = {Name: Options.signatorname, Rank: Options.signatorrank, Unit: Options.signatorunit, Position: Options.signatorposition}; | ||
} | ||
const Doc = new PDFDocument({size: "A4"}); | ||
Doc.pipe(FS.createWriteStream("AuthorityPaper.pdf")); | ||
const Stream = FS.createWriteStream("AuthorityPaper.pdf"); | ||
Doc.pipe(Stream); | ||
Doc.registerFont("typewriter", FONT); | ||
@@ -129,3 +138,3 @@ Doc.registerFont("handwriting", HANDWRITTEN_FONT); | ||
.fontSize(12) | ||
.text(`05/05/05`, { | ||
.text(`${CurrentDate.getDate()}/${CurrentDate.getMonth()+1}/${CurrentDate.getFullYear()}`, { | ||
align: "right", | ||
@@ -185,5 +194,3 @@ }).moveDown(2) | ||
}) | ||
.moveDown().font("typewriter").text(`${Signator.Position} ${Signator.Unit}`, { | ||
continued: true | ||
}) | ||
.moveDown().font("typewriter").text(`${Signator.Position} ${Signator.Unit}`) | ||
@@ -196,3 +203,5 @@ Doc | ||
console.log(`\nSaved to: ${process.cwd()}\\${Stream.path}.`) | ||
Doc.end(); | ||
})(); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
680944
10
204