aboutsummaryrefslogtreecommitdiffstats
path: root/fuzzycat/__main__.py
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-12-15 02:56:27 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-12-15 02:56:27 +0100
commit024694edb909eeb047115ab62a52df6786f931c0 (patch)
tree99e8613f996bbe276bf7601c2abebc9cb4d09d0f /fuzzycat/__main__.py
parentb9b2aafe08abc7f131514a2eba804a569d424efb (diff)
downloadfuzzycat-024694edb909eeb047115ab62a52df6786f931c0.tar.gz
fuzzycat-024694edb909eeb047115ab62a52df6786f931c0.zip
fix cmdline tool
Diffstat (limited to 'fuzzycat/__main__.py')
-rw-r--r--fuzzycat/__main__.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/fuzzycat/__main__.py b/fuzzycat/__main__.py
index 8ff20f5..23009d3 100644
--- a/fuzzycat/__main__.py
+++ b/fuzzycat/__main__.py
@@ -72,9 +72,17 @@ def run_verify_single(args):
if args.a and args.b:
a, b = args.a, args.b
elif not args.a and not args.b:
- word = random_word(wordsfile='/usr/share/dict/words')
- a, b = random_idents_from_query(query=word, r=2)
- result.update({"extra": {"q": "https://fatcat.wiki/release/search?q={}".format(word)}})
+ for _ in range(10):
+ word = random_word(wordsfile='/usr/share/dict/words')
+ try:
+ idents = random_idents_from_query(query=word, r=2)
+ except RuntimeError:
+ continue
+ result.update({"extra": {"q": "https://fatcat.wiki/release/search?q={}".format(word)}})
+ a, b = idents
+ break
+ else:
+ raise RuntimeError('could not fetch random releases')
else:
raise ValueError('specify either both -a, -b or none')