in scripts/workbook_create.py [0:0]
def get_output_file(checklist_file_or_url, is_file=True):
# If output file specified, use it
if args.output_file:
return args.output_file
# Else, figure out one
elif args.output_path:
# First come up with an initial filename, depending if provided a file or an URL
if is_file:
output_file = os.path.basename(checklist_file_or_url)
else:
output_file = checklist_file_or_url.split('/')[-1]
# Get filename without path and extension
output_file = os.path.join(args.output_path, output_file)
# If category specified, add to output file name
if args.category:
output_file = os.path.splitext(output_file)[0] + '_' + str(args.category).lower() + '.json'
# If counters created, add 'counters' to output file name
if args.counters:
output_file = os.path.splitext(output_file)[0] + '_counters.json'
# Return the final file name
return os.path.splitext(output_file)[0] + '_workbook.json'