-def show(stack, headers):
- idx = Status()
- wrapper(display.get_key, stack, headers, idx)
+def show(args, stack, headers):
+ """
+ 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)
+ if args.purge_all:
+ progress.purge_all()
+
+ # Check for caches
+ ida = progress.dive("status", stack)
+ if ida:
+ idx = ida
+ else:
+ idx = Status()
+
+ stackb = progress.dive("stack", stack)
+ if stackb:
+ stack = stackb
+
+ headerb = progress.dive("headers", stack)
+ if headerb:
+ headers = headerb
+
+ # Manipulate deck
+ if args.flip:
+ for x in stack:
+ x[0], x[1] = x[1], x[0]
+ headers[0], headers[1] = headers[1], headers[0]
+ if args.shuffle:
+ shuffle(stack)
+ if args.reverse:
+ stack.reverse()
+
+ # Send to display
+ win = Display(stack, headers, idx)
+ wrapper(win.run)
+
+
+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))