You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

50 lines
1.1 KiB

#! /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))