from mdoc import extractor
import re
-usage = 'mdoc-extract <source> <class>'
+usage = 'mdoc-extract <source> <class> [target]'
def command_dispatch(args):
# check runtime parameters
if len(args) < 2:
- raise RuntimeError("mdoc-extract needs 2 arguments.")
+ raise RuntimeError("mdoc-extract needs 2/3 arguments.")
file = args[0]
classs = args[1]
- target = re.sub(r'\..*', '.tex', file)
+ if len(args) == 3:
+ target = args[2]
+ else:
+ target = re.sub(r'\..*', '.tex', file)
return extractor.extract(file, classs, target)