22 lines
489 B
Plaintext
Executable file
22 lines
489 B
Plaintext
Executable file
#! /usr/bin/env nix-shell
|
|
#! nix-shell -i python3 -p python3
|
|
import sys
|
|
import os
|
|
import secrets
|
|
|
|
prefix = os.getenv('HOME') + '/.local/share/words/'
|
|
|
|
if len(sys.argv) == 2:
|
|
ct = int(sys.argv[1])
|
|
wl = 'default'
|
|
elif len(sys.argv) == 3:
|
|
ct = int(sys.argv[1])
|
|
wl = sys.argv[2]
|
|
else:
|
|
print(f'Usage: {sys.argv[0]} nwords [wordlist]')
|
|
exit(1)
|
|
|
|
words = [word.strip() for word in open(prefix + wl).readlines()]
|
|
|
|
print(' '.join([secrets.choice(words) for _ in range(ct)]))
|