forked from theonetruemango/pfspellcards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commandlinegenerator.py
25 lines (20 loc) · 896 Bytes
/
commandlinegenerator.py
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
import argparse
from spellscsvtodict import SpellsCsvToDict
from spellpdfprinter import SpellPdfPrinter
def makeSpellCards(spellNames):
spellDescriptions = SpellsCsvToDict()
spells = spellDescriptions.getSpells(spellNames)
pdfPrinter = SpellPdfPrinter(spells)
pdfPrinter.getSixPerSheetPdf()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('spells', nargs = '*', help='Names of spells to get cards for')
parser.add_argument('-f', '--files', nargs = '*', help = 'File mode. Input file names containing names of spells separated by a newline')
args = parser.parse_args()
spells = args.spells if args.spells else []
if(args.files):
for file in args.files:
with open(file) as spellList:
for spell in spellList:
spells.append(spell.strip())
makeSpellCards(spells)