aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorWolfgang Müller2024-11-11 16:04:29 +0100
committerWolfgang Müller2024-11-11 16:04:29 +0100
commitcfb490601f2d7045499d3556201992765db13ce4 (patch)
treea1c7019c71301e1751d251853ace1f28ef5a0106 /src
parent65894a5f7da0d58eebcdb5664ec116b31056a2ab (diff)
downloadlater-trunk.tar.gz
Hardcode default commandsHEADtrunk
We really don't need to influence these dynamically, so simplify the code a bit by hardcoding the default "list" and "add" commands in parse_args().
Diffstat (limited to 'src')
-rw-r--r--src/later/cli.py6
-rw-r--r--src/later/main.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/later/cli.py b/src/later/cli.py
index 809632f..ece41ce 100644
--- a/src/later/cli.py
+++ b/src/later/cli.py
@@ -54,7 +54,7 @@ def list_entries(args, entries):
entries.print()
-def parse_args(argv, default, default_args):
+def parse_args(argv):
commands = {
"add": Command("add", add_entries),
"del": Command("del", delete_entries),
@@ -66,7 +66,7 @@ def parse_args(argv, default, default_args):
except getopt.GetoptError as e:
usage(e)
- parsed_args = Arguments(command=commands[default])
+ parsed_args = Arguments(command=commands["list"])
for option in options:
match option:
@@ -77,7 +77,7 @@ def parse_args(argv, default, default_args):
if args[0] in commands:
parsed_args.command = commands[args.pop(0)]
else:
- parsed_args.command = commands[default_args]
+ parsed_args.command = commands["add"]
parsed_args.rest = args
diff --git a/src/later/main.py b/src/later/main.py
index 1d07cac..6bf2426 100644
--- a/src/later/main.py
+++ b/src/later/main.py
@@ -17,7 +17,7 @@ title_map_file = os.path.join(later_cache_dir, "titles.json")
def main():
- args = parse_args(sys.argv[1:], "list", "add")
+ args = parse_args(sys.argv[1:])
title_map = TitleMap(title_map_file, update=args.update_titles)
entries = EntryManager(watch_later_dir, title_map)