]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/runner.py
Change flip cards option to a view
[lightcards.git] / lightcards / runner.py
index 2fa42f49e6cc214c92b82d2d1ea8a76fc825acb9..a0c8a094c02374abc5d3650e76cfd9921445e033 100644 (file)
@@ -4,6 +4,7 @@
 import argparse
 from curses import wrapper
 import os
+import pkg_resources
 from random import shuffle
 import sys
 
@@ -13,6 +14,7 @@ from .deck import Status
 
 
 def parse_args():
+    """Parse command line arguments"""
     parser = argparse.ArgumentParser(
         description="Terminal flashcards from Markdown"
     )
@@ -23,9 +25,6 @@ def parse_args():
         action="store_true",
         help="alphabetize card order",
     )
-    parser.add_argument(
-        "-f", "--flip", action="store_true", help="show second column first"
-    )
     parser.add_argument(
         "-p",
         "--purge",
@@ -39,7 +38,10 @@ def parse_args():
         "-s", "--shuffle", action="store_true", help="shuffle card order"
     )
     parser.add_argument(
-        "-v", "--version", action="version", version="lightcards 0.6.0"
+        "-v",
+        "--version",
+        action="version",
+        version=f"lightcards {pkg_resources.require('lightcards')[0].version}",
     )
     return parser.parse_args()
 
@@ -55,7 +57,7 @@ def show(args, stack, headers):
 
     # Check for caches
     idx = Status()
-    cache = progress.dive(get_orig())
+    cache = progress.dive(get_orig()[1])
     if cache:
         (stack) = cache
 
@@ -63,13 +65,9 @@ def show(args, stack, headers):
     if args.shuffle:
         shuffle(stack)
     if args.alphabetize:
-        stack.sort()
+        stack.sort(key=lambda x: x.front)
     if args.reverse:
         stack.reverse()
-    if args.flip:
-        for x in stack:
-            x[0], x[1] = x[1], x[0]
-        headers[0], headers[1] = headers[1], headers[0]
 
     # Send to display
     win = Display(stack, headers, idx)