Skip to content

Commit

Permalink
Merge pull request #1 from jpreiss/main
Browse files Browse the repository at this point in the history
argparse CLI
  • Loading branch information
joaoperfig committed Nov 28, 2021
2 parents a3b5e9b + b071ab5 commit 7a53451
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import argparse
import os
import pickle
import sys
#from IPython import embed
from tqdm import tqdm
from itertools import combinations
Expand Down Expand Up @@ -37,18 +39,47 @@ def get_tree():
return tree

if __name__ == "__main__":
tree = get_tree()
if len(sys.argv) > 1:
parser = argparse.ArgumentParser(
description="Generator of Rad Names from Decent Paper Acronyms"
)
parser.add_argument(
"words",
type=str,
nargs="+",
help="Paper title words.",
)
parser.add_argument(
"--ordered",
action="store_true",
help="Preserve word order.",
)
parser.add_argument(
"--minwords",
type=int,
default=0,
help="Minimum number of used words. (default 0 => use all.)",
)
args = parser.parse_args()
words = args.words
preserve_order = args.ordered
use_all = args.minwords in (0, len(words))
minwords = 1
if not use_all:
minwords = args.minwords
else:
print()
print("Please input paper title words separated by spaces")
words = input(">").split(" ")

print()
print("Please input paper title words separated by spaces")
words = input(">").split(" ")
words = [word.lower() for word in words]
preserve_order = input("Preserve word order? y/n >") == "y"
use_all = input("Force use of all words? y/n >") == "y"
minwords = 1
if not use_all:
minwords = eval(input("Minimum number of used words: >"))

preserve_order = input("Preserve word order? y/n >") == "y"
use_all = input("Force use of all words? y/n >") == "y"
minwords = 1
if not (use_all):
minwords = eval(input("Minimum number of used words: >"))
tree = get_tree()
words = [word.lower() for word in words]

orders = []
if preserve_order and use_all:
Expand Down

0 comments on commit 7a53451

Please sign in to comment.