X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=lightcards%2Frunner.py;h=f9f1abd9437d5f430bd7e6da721fc0562beb2b76;hb=4e5a09ff518efbffe31ce064334cb1db1d42eae4;hp=2fa42f49e6cc214c92b82d2d1ea8a76fc825acb9;hpb=3c884626432e00720894132ec86e378f1b92d6ef;p=lightcards.git diff --git a/lightcards/runner.py b/lightcards/runner.py index 2fa42f4..f9f1abd 100644 --- a/lightcards/runner.py +++ b/lightcards/runner.py @@ -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" ) @@ -39,7 +41,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 +60,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,7 +68,7 @@ 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: