Skip to content
Snippets Groups Projects

Make TTQ behave better in scripts

Merged Imported Administrator requested to merge use-stderr into master
4 files
+ 47
9
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 7
1
@@ -10,9 +10,11 @@ ARGS_QUERY_SOCS = {}
ARGS_QUERY_DEVICES = []
ARGS_QUERY_UI = ""
ARGS_USER_TYPE = "gitlab"
BULLET_POINT = "*"
def parse_args():
global ARGS
global BULLET_POINT
ttq = sys.argv[0]
examples = ("examples:\n"
@@ -39,10 +41,14 @@ def parse_args():
help="show matrix users instead of gitlab users")
parser.add_argument("-n", "--notes", action="store_true",
help="print notes (if any)")
parser.add_argument("-c", "--checkboxes", action="store_true",
help="Use checkboxes instead of bullet points")
parser.add_argument("QUERY", nargs="?",
help="what to search for")
ARGS = parser.parse_args()
if ARGS.checkboxes:
BULLET_POINT = "* [ ]"
def parse_args_query_soc():
@@ -55,7 +61,7 @@ def parse_args_query_soc():
for soc in ttq.wiki.SOCS:
if search_str in soc.lower():
devices = ttq.wiki.parse_soc_devices(soc)
print(f"Found {len(devices)} device(s) with {soc}")
print(f"Found {len(devices)} device(s) with {soc}", file=sys.stderr)
ARGS_QUERY_SOCS[soc] = devices
# Put devices in ARGS_QUERY_DEVICES so ttq.match.by_device() can use it
Loading