diff --git a/MOLER/main.py b/MOLER/main.py new file mode 100644 index 0000000..580ff8a --- /dev/null +++ b/MOLER/main.py @@ -0,0 +1,49 @@ +#! /usr/bin/env python3 +"""Glue together the matrix and org-mode!""" + +from orgparse import load, loads + +import argparse +import sys + + +def idb_excepthook(type, value, tb): + """Call an interactive debugger in post-mortem mode + If you do "sys.excepthook = idb_excepthook", then an interactive debugger + will be spawned at an unhandled exception + """ + if hasattr(sys, "ps1") or not sys.stderr.isatty(): + sys.__excepthook__(type, value, tb) + else: + import pdb + import traceback + + traceback.print_exception(type, value, tb) + print + pdb.pm() + + +def main(*args, **kwargs): + parser = argparse.ArgumentParser(description="") + parser.add_argument( + "--debug", "-d", action="store_true", help="Include debugging output" + ) + + parsed = parser.parse_args() + if parsed.debug: + sys.excepthook = idb_excepthook + + load("PATH/TO/FILE.org") + # load(file_like_object) + + loads( + """ + * This is org-mode contents + You can load org object from string. + ** Second header + """ + ) + + +if __name__ == "__main__": + sys.exit(main(*sys.argv)) diff --git a/pyproject.toml b/pyproject.toml index 1badc36..c638a6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 88 -target-version = ['py39'] +target-version = ['py38'] include = '\.pyi?$' exclude = '''