Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
p.add_argument('-o', '--output',
metavar='PATH_PAT',
help='Set output path (incl. the placeholders: dirname, basename,'
'base, ext, now) in both, %%(name)s and {name} notations.'
)
line_filter_default = u''
p.add_argument('input',
metavar='PATH',
nargs='*',
help='Input SVG file path with extension .svg or .svgz.')
args = p.parse_args()
if args.version:
print(svglib.__version__)
sys.exit()
if not args.input:
p.print_usage()
sys.exit()
paths = [a for a in args.input if exists(a)]
for path in paths:
convert_file(path, outputPat=args.output)
def cli_main():
args = dict(
prog=basename(sys.argv[0]),
version=svglib.__version__,
author=svglib.__author__,
license=svglib.__license__,
copyleft_year=svglib.__date__[:svglib.__date__.find('-')],
ts_pattern="{{dirname}}/out-"\
"{{now.hour}}-{{now.minute}}-{{now.second}}-"\
"%(base)s",
)
if args['prog'].endswith('2ps'):
args['ext'] = 'eps'
elif args['prog'].endswith('2pdf'):
args['ext'] = 'pdf'
elif args['prog'].endswith('2pm'):
args['ext'] = 'pm'
args['ext_caps'] = args['ext'].upper()
args['ts_pattern'] += ('.%s' % args['ext'])
desc = '{prog} v. {version}\n'.format(**args)