commit 881f0831cc7939a4f409d662f1b1586ebfaf4cf2
parent 4d6fddac74279c9334d98981f6ab55b00c364176
Author: pyratebeard <root@pyratebeard.net>
Date: Thu, 29 Sep 2022 22:31:00 +0100
set vars from args, default search items. parse query for issue # /date
Diffstat:
M | longbox | | | 29 | ++++++++++++++++++++++++++++- |
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/longbox b/longbox
@@ -47,7 +47,7 @@ confpath = get_conf_dir()
mkdirs(confpath)
boxrc = os.path.join(confpath, 'longboxrc')
-# parse arguments
+#░ parse arguments
parser = argparse.ArgumentParser(description = "comic book stash manager")
parser.add_argument("-q", "--query", help = "search for stuff", required = False, action='store', nargs='+')
parser.add_argument("-i", "--issue-id", help = "show specific issue id", required = False, default = None)
@@ -62,3 +62,30 @@ parser_stash.add_argument("-i", "--stash-issue", help = "stash specific issue",
parser_stash.add_argument("--show-variants", help = "show issue variants", required = False, action = 'store_true')
argument = parser.parse_args()
+
+#░ vars from args
+query = argument.query
+issue_id = argument.issue_id
+series_id = argument.series_id
+variants = argument.show_variants
+
+#░ default search items
+search_series = '%'
+search_number = None
+search_date = None
+
+#░ parse query for date and/or issue number
+#░ issue number must start with #
+if query:
+ search_series = query[0]
+ # switch wildcard for use with mysql
+ search_series = search_series.replace('*', '%')
+ if len(query) >= 2:
+ numregexp = re.compile(r'^#')
+ dateregexp = re.compile(r'^[0-9]')
+ for q in query[1:]:
+ if numregexp.search(q):
+ search_number = q.lstrip('#')
+ if dateregexp.search(q):
+ search_date = q
+