X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mDoc.git/blobdiff_plain/596f28b2ecf6b1f371c8e71f702697f391af929b..73539fefaba455c976c38489226ff4eeac688bab:/python/mDoc/mdoc_extract.py diff --git a/python/mDoc/mdoc_extract.py b/python/mDoc/mdoc_extract.py new file mode 100755 index 0000000..6226d79 --- /dev/null +++ b/python/mDoc/mdoc_extract.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +''' +Created on 26.03.2021 + +@author: antix19 +''' +import sys +from mdoc import extractor +import re + +usage = 'mdoc-extract ' + +def command_dispatch(args): + + # check runtime parameters + if len(args) < 2: + raise RuntimeError("mdoc-extract needs 2 arguments.") + + file = args[0] + classs = args[1] + target = re.sub(r'\..*', '.tex', file) + + return extractor.extract(file, classs, target) + + +# evaulate runtime parameters +if __name__ == '__main__': + try: + ret = command_dispatch(sys.argv[1:]) + if ret != 0: + print ("Operation returned: "+str(ret)) + exit (ret) + except Exception as e: + print (e) + print (usage) + raise \ No newline at end of file