Rename module args to match CLI versions
authorScot Hacker <redacted>
Thu, 1 Oct 2015 04:33:31 +0000 (21:33 -0700)
committerScot Hacker <redacted>
Thu, 1 Oct 2015 04:33:31 +0000 (21:33 -0700)
Resolves https://github.com/redacted/XKCD-password-generator/issues/27

setup.py
xkcdpass/xkcd_password.py

index dd61199234867156cc44285c19ef6ce8a4bacf38..efb255257f3fca0a772269f795c7df8804558ce2 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
 
 setup(
     name='xkcdpass',
-    version='1.2.5',
+    version='1.2.6',
     author='Steven Tobin',
     author_email='steventtobin@gmail.com',
     url='https://github.com/redacted/XKCD-password-generator',
index a1beffa77688ca146929e98d278b22b4f24afd9e..83a9f120a9fade2e0d6a54986ab84fcfe15e8c1d 100755 (executable)
@@ -199,17 +199,17 @@ def find_acrostic(acrostic, worddict):
 
 
 def generate_xkcdpassword(wordlist,
-                          n_words=6,
+                          numwords=6,
                           interactive=False,
                           acrostic=False,
-                          delim=" "):
+                          delimiter=" "):
     """
     Generate an XKCD-style password from the words in wordlist.
     """
 
     passwd = False
 
-    if len(wordlist) < n_words:
+    if len(wordlist) < numwords:
         sys.stderr.write("Could not get enough words!\n"
                          "This could be a result of either your wordfile\n"
                          "being too small, or your settings too strict.\n")
@@ -222,9 +222,9 @@ def generate_xkcdpassword(wordlist,
     # useful if driving the logic from other code
     if not interactive:
         if not acrostic:
-            passwd = delim.join(rng().sample(wordlist, n_words))
+            passwd = delimiter.join(rng().sample(wordlist, numwords))
         else:
-            passwd = delim.join(find_acrostic(acrostic, worddict))
+            passwd = delimiter.join(find_acrostic(acrostic, worddict))
 
         return passwd
 
@@ -233,17 +233,17 @@ def generate_xkcdpassword(wordlist,
         custom_n_words = raw_input("Enter number of words (default 6): ")
 
         if custom_n_words:
-            n_words = int(custom_n_words)
+            numwords = int(custom_n_words)
     else:
-        n_words = len(acrostic)
+        numwords = len(acrostic)
 
     accepted = "n"
 
     while accepted.lower() not in ["y", "yes"]:
         if not acrostic:
-            passwd = delim.join(rng().sample(wordlist, n_words))
+            passwd = delimiter.join(rng().sample(wordlist, numwords))
         else:
-            passwd = delim.join(find_acrostic(acrostic, worddict))
+            passwd = delimiter.join(find_acrostic(acrostic, worddict))
         print("Generated: ", passwd)
         accepted = raw_input("Accept? [yN] ")
 
@@ -299,7 +299,7 @@ def main():
         help="Generate COUNT passphrases.")
     parser.add_option(
         "-d", "--delimiter",
-        dest="delim", default=" ", metavar="DELIM",
+        dest="delimiter", default=" ", metavar="DELIM",
         help="Separate words within a passphrase with DELIM.")
 
     (options, args) = parser.parse_args()
@@ -319,9 +319,9 @@ def main():
     while count > 0:
         print(generate_xkcdpassword(my_wordlist,
                                     interactive=options.interactive,
-                                    n_words=options.numwords,
+                                    numwords=options.numwords,
                                     acrostic=options.acrostic,
-                                    delim=options.delim))
+                                    delimiter=options.delimiter))
         count -= 1
 
 
git clone https://git.99rst.org/PROJECT