refactor: Move backward compatible argument handling into config loader
This commit is contained in:
parent
1402321e00
commit
153ac4227a
@ -19,11 +19,7 @@ def main():
|
||||
"ankisyncd {} ({})".format(ankisyncd._get_version(), ankisyncd._homepage)
|
||||
)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
# backwards compat
|
||||
config = ankisyncd.config.load(sys.argv[1])
|
||||
else:
|
||||
config = ankisyncd.config.load()
|
||||
config = ankisyncd.config.load(sys.argv)
|
||||
|
||||
ankiserver = SyncApp(config)
|
||||
run_server(ankiserver, config["host"], int(config["port"]))
|
||||
|
||||
@ -26,6 +26,11 @@ def load_from_env(conf):
|
||||
|
||||
|
||||
def load(path=None):
|
||||
# backwards compat
|
||||
if len(path) > 1:
|
||||
path = path[1]
|
||||
else:
|
||||
path = None
|
||||
choices = paths
|
||||
parser = configparser.ConfigParser()
|
||||
if path:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user