]> git.armaanb.net Git - lightcards.git/commitdiff
Add alphabetize option
authorArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 17:37:31 +0000 (12:37 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 17:37:31 +0000 (12:37 -0500)
lightcards/lightcards.py
man/lightcards.1
man/lightcards.1.md

index 768ac6852a14eb9d18a9c2960125db0ced324b2f..ed1916d371ae9d833af41435772c5ed2680c8a70 100644 (file)
@@ -19,6 +19,9 @@ def parse_args():
                         metavar="input file",
                         type=str,
                         nargs=1)
+    parser.add_argument("-a", "--alphabetize",
+                        action='store_true',
+                        help="alphabetize card order")
     parser.add_argument("-f", "--flip",
                         action='store_true',
                         help="show second column first")
@@ -60,14 +63,16 @@ def show(args, stack, headers):
         idx = Status()
 
     # 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.alphabetize:
+        stack.sort()
     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)
index 50ad3b0814b4eed46163804223118868069a1bbd..06dd0c594e9a92e71ddcb6fd1035e43ab1051bc9 100644 (file)
@@ -22,6 +22,9 @@ Relative or absolute path to the input Markdown or HTML file
 \f[B]-h\f[R], \f[B]\[en]help\f[R]
 Show a help message and exit
 .TP
+\f[B]-a\f[R], \f[B]\[en]alphabetize\f[R]
+Alphabetize card order
+.TP
 \f[B]-f\f[R], \f[B]\[en]flip\f[R]
 Show second column first
 .TP
index 275733d5307ce0cc07d431aaaee2071e24ad3212..adcb7e208bc294039e18a3c03f3d7bcb832217aa 100644 (file)
@@ -19,6 +19,9 @@ lightcards [[options]] [input file]
 **-h**, **--help**
 : Show a help message and exit
 
+**-a**, **--alphabetize**
+: Alphabetize card order
+
 **-f**, **--flip**
 : Show second column first