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)
|
"ankisyncd {} ({})".format(ankisyncd._get_version(), ankisyncd._homepage)
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
config = ankisyncd.config.load(sys.argv)
|
||||||
# backwards compat
|
|
||||||
config = ankisyncd.config.load(sys.argv[1])
|
|
||||||
else:
|
|
||||||
config = ankisyncd.config.load()
|
|
||||||
|
|
||||||
ankiserver = SyncApp(config)
|
ankiserver = SyncApp(config)
|
||||||
run_server(ankiserver, config["host"], int(config["port"]))
|
run_server(ankiserver, config["host"], int(config["port"]))
|
||||||
|
|||||||
@ -26,6 +26,11 @@ def load_from_env(conf):
|
|||||||
|
|
||||||
|
|
||||||
def load(path=None):
|
def load(path=None):
|
||||||
|
# backwards compat
|
||||||
|
if len(path) > 1:
|
||||||
|
path = path[1]
|
||||||
|
else:
|
||||||
|
path = None
|
||||||
choices = paths
|
choices = paths
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
if path:
|
if path:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user