aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-03-06 00:39:46 +0100
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-03-06 01:38:30 +0100
commit2a87dc627cbe44ccc6c830c34140fdf7aec47661 (patch)
tree70570a6ad2605e99347977ccfd72c0232d3f24ea
parentProvide --lines command with small refactoring of necessary parts (diff)
downloadtodoist-2a87dc627cbe44ccc6c830c34140fdf7aec47661.tar.xz
Move dump to separate function
-rwxr-xr-xtodoist7
1 files 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