From 2a87dc627cbe44ccc6c830c34140fdf7aec47661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Sun, 6 Mar 2016 00:39:46 +0100 Subject: Move dump to separate function --- todoist | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/todoist b/todoist index 96092ef..837ffb9 100755 --- a/todoist +++ b/todoist @@ -90,6 +90,10 @@ def store_token(token): with open(path, mode="w+") as f: f.write(token) +def dump(data): + with open(DUMP_FILENAME, mode="w") as f: + pprint(data, f) + def build_project_list(data): projects = { proj["name"].lower(): proj["id"] for proj in data["Projects"] } return projects @@ -148,8 +152,7 @@ def main(): sys.exit(1) if args.dump: - with open(DUMP_FILENAME, mode="w") as f: - pprint(data, f) + dump(data) sys.exit(0) ## Prepare data structures -- cgit v1.2.3