Add option to disable local disk caching of the todo list

pull/15/head
Andrew Williams 2016-08-04 11:03:10 +01:00
parent fa757f33d1
commit 73361c7f89
1 changed files with 8 additions and 1 deletions

View File

@ -48,6 +48,7 @@ def main():
parser.add_argument('--hide_future', help='Hide future dated next actions until the specified number of days',
default=7, type=int)
parser.add_argument('--onetime', help='Update Todoist once and exit', action='store_true')
parser.add_argument('--nocache', help='Disables caching data to disk for quicker syncing', action='store_true')
args = parser.parse_args()
# Set debug
@ -64,7 +65,13 @@ def main():
# Run the initial sync
logging.debug('Connecting to the Todoist API')
api = TodoistAPI(token=args.api_key)
api_arguments = {'token': args.api_key}
if args.nocache:
logging.debug('Disabling local caching')
api_arguments['cache'] = None
api = TodoistAPI(**api_arguments)
logging.debug('Syncing the current state from the API')
api.sync()