fix: properly detect flags after -link and -date
Previously, /edit 28 -link -date would treat -date as the link value. Now it checks if the next argument starts with "-" to detect flags.
This commit is contained in:
@@ -106,14 +106,14 @@ def parse_args(
|
|||||||
arg = args[i]
|
arg = args[i]
|
||||||
|
|
||||||
if arg == "-link":
|
if arg == "-link":
|
||||||
if i + 1 < len(args):
|
if i + 1 < len(args) and not args[i + 1].startswith("-"):
|
||||||
link = args[i + 1]
|
link = args[i + 1]
|
||||||
i += 2
|
i += 2
|
||||||
else:
|
else:
|
||||||
clear_link = True
|
clear_link = True
|
||||||
i += 1
|
i += 1
|
||||||
elif arg == "-date":
|
elif arg == "-date":
|
||||||
if i + 1 < len(args):
|
if i + 1 < len(args) and not args[i + 1].startswith("-"):
|
||||||
due_date_ts = parse_date_with_tz(args[i + 1])
|
due_date_ts = parse_date_with_tz(args[i + 1])
|
||||||
if due_date_ts is not None:
|
if due_date_ts is not None:
|
||||||
i += 2
|
i += 2
|
||||||
|
|||||||
Reference in New Issue
Block a user