Update arg parsing to better handle optinal journal name

Fixes #520 -and parameter seems to only work for the default journal
This commit is contained in:
Jonathan Wren 2020-07-01 14:47:05 -07:00
parent 2b2f24449f
commit 5922ca41ee
3 changed files with 43 additions and 22 deletions

View file

@ -64,7 +64,6 @@ def parse_args(args=None):
"Composing",
'To write an entry simply write it on the command line, e.g. "jrnl yesterday at 1pm: Went to the gym."',
)
composing.add_argument("text", metavar="", nargs="*")
reading = parser.add_argument_group(
"Reading",
@ -110,9 +109,10 @@ def parse_args(args=None):
reading.add_argument(
"-not",
dest="excluded",
nargs="+",
nargs="?",
default=[],
metavar="E",
action="append",
help="Exclude entries with these tags",
)
@ -203,6 +203,9 @@ def parse_args(args=None):
help="Opens an interactive interface for deleting entries.",
)
# Everything else
composing.add_argument("text", metavar="", nargs="*")
if not args:
args = []
@ -210,7 +213,7 @@ def parse_args(args=None):
num = re.compile(r"^-(\d+)$")
args = [num.sub(r"-n \1", arg) for arg in args]
return parser.parse_args(args)
return parser.parse_intermixed_args(args)
def guess_mode(args, config):