parser = argparse.ArgumentParser(
description="Terminal flashcards from Markdown"
)
+ parser.add_argument(
+ "-c",
+ "--config",
+ type=str,
+ help="specify custom config file",
+ )
parser.add_argument(
"-V",
"--view",
return parser.parse_args()
-def show(args, stack, headers):
+def show(args, stack, headers, input_file):
"""
Get objects from cache, manipulate deck according to passed arguments, and
send it to the display functions
"""
# Purge caches if asked
if args.purge:
- progress.purge(stack)
+ progress.purge(get_orig()[1])
# Check for caches
idx = Status()
stack.reverse()
# Send to display
- win = Display(stack, headers, idx, args.view)
+ win = Display(stack, headers, idx, args.view, input_file)
try:
curses.wrapper(win.run)
except curses.error as e:
raise CursesError() from e
-def reparse():
- """Parse arguments and input file again"""
- args = parse_args()
- os.system(f"$EDITOR {args.inp[0]}"),
- return parse.parse_html(parse.md2html(args.inp[0]))
-
-
def get_orig():
"""Return original header and stack"""
return (headers, stack)
args = parse_args()
global headers, stack
(headers, stack) = parse.parse_html(parse.md2html(args.inp[0]))
- show(args, stack, headers)
+ show(args, stack, headers, args)
if __name__ == "__main__":