Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 262fe4b

Browse files
committed
Fixed default option and expanded on --help flag
1 parent 6333723 commit 262fe4b

File tree

3 files changed

+44
-10
lines changed

3 files changed

+44
-10
lines changed

RELEASE_NOTES.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Release Notes
2+
This is a dedicated page which documents the changes made to the [Diceware Password Generator][diceware] as well as all the release notes for the software.
3+
4+
## v1.0.2
5+
Release Date: 19 March 2018
6+
7+
- Expanded on `-h` option to include `--help` as a flag.
8+
- Fixed default option so you can just run `$ ./passphrase` without any options and it will return 5 words from the default list.
9+
- Added license to `download-words`.
10+
- Printed out more meaningful help when there's an exception when running the script.
11+
12+
## v1.0.1
13+
Release Date: 18 March 2018
14+
15+
- Minor changes to the output of the command line options.
16+
- Minor visual update to the License file.
17+
18+
## v1.0.0
19+
Release Date: 15 March 2018
20+
21+
- First major release since working on the project.
22+
- Re-factored the original source code to incorporate:
23+
+ 5 word list dictionaries.
24+
+ Flags for options as part of the command execution.
25+
- New license; public domain.
26+
27+
[diceware]: https://justin.hartman.me/projects/diceware-password-generator.html

download-words

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/bin/sh
2+
#
3+
# The author disclaims copyright to this source code. In place of
4+
# a legal notice, here is a blessing:
5+
#
6+
# - May you do good and not evil.
7+
# - May you find forgiveness for yourself and forgive others.
8+
# - May you share freely, never taking more than you give.
9+
#
210
curl -o words https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
311
curl -o words-vorvig http://norvig.com/ngrams/count_1w.txt
412
curl -o words-short-memorable https://www.eff.org/files/2016/09/08/eff_short_wordlist_1.txt

passphrase

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ def main(argv):
1515
short = [s.split()[1] for s in open(sys.path[0]+'/words-short-memorable')]
1616
edit = [s.split()[1] for s in open(sys.path[0]+'/words-short-edit')]
1717
beale = [s.split()[1] for s in open(sys.path[0]+'/words-beale')]
18-
p = ''
19-
n = ''
18+
p = words
19+
n = range(5)
2020
try:
21-
opts, args = getopt.getopt(argv,"hbwvsen:",["beale","words","vorvig","number","short","edit"])
22-
except getopt.GetoptError:
23-
print 'Run ./passphrase -h for help.'
21+
opts, args = getopt.getopt(argv,"hbwvsen:",["beale","words","vorvig","number","short","edit", "help"])
22+
except Exception as e:
23+
print e
24+
print 'To get help, run $ ./passphrase -h or $ ./passphrase --help'
2425
sys.exit(2)
2526
for opt, arg in opts:
26-
if opt == '-h':
27+
if opt in ('-h', '--help'):
2728
print '# Version: diceware-password-generator 1.0.1'
2829
print '# Release Date: 18 March 2018'
2930
print '# Project: https://justin.hartman.me/projects/diceware-password-generator.html'
@@ -37,7 +38,7 @@ def main(argv):
3738
print '#'
3839
print 'Usage: $ ./passphrase [options] [-n] <number of words>'
3940
print 'Options:'
40-
print '-w, --words Standard word list (default)'
41+
print '-w, --words Standard word list (default list)'
4142
print '-v, --vorvig Vorvig word list'
4243
print '-s, --short Short, memorable word list'
4344
print '-e, --edit Short, editable word list. Experimental.'
@@ -47,7 +48,7 @@ def main(argv):
4748
print ' you want generated for your passphrase.'
4849
print ''
4950
print 'Example: $ ./passphrase --words -n 4'
50-
sys.exit()
51+
sys.exit(2)
5152
elif opt in ("-w", "--words"):
5253
p = words
5354
elif opt in ("-b", "--beale"):
@@ -60,8 +61,6 @@ def main(argv):
6061
p = edit
6162
if opt in ("-n", "--number"):
6263
n = range(int(arg))
63-
elif opt:
64-
n = range(5)
6564
print '-'.join(random.SystemRandom().choice(p) for i in n)
6665

6766
if __name__ == "__main__":

0 commit comments

Comments
 (0)