diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2016-03-06 00:39:46 +0100 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2016-03-06 01:38:30 +0100 |
commit | 2a87dc627cbe44ccc6c830c34140fdf7aec47661 (patch) | |
tree | 70570a6ad2605e99347977ccfd72c0232d3f24ea | |
parent | Provide --lines command with small refactoring of necessary parts (diff) | |
download | todoist-2a87dc627cbe44ccc6c830c34140fdf7aec47661.tar.xz |
Move dump to separate function
-rwxr-xr-x | todoist | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |