Add "onetime" option to force a single sync only

pull/15/head
Andrew Williams 2015-12-12 14:35:08 +00:00
parent cde3a631b3
commit 861c7e1b10
1 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,7 @@ def main():
parser.add_argument('--serial_suffix', default='_') parser.add_argument('--serial_suffix', default='_')
parser.add_argument('--hide_future', help='Hide future dated next actions until the specified number of days', parser.add_argument('--hide_future', help='Hide future dated next actions until the specified number of days',
default=7, type=int) default=7, type=int)
parser.add_argument('--onetime', help='Update Todoist once and exit', action='store_true')
args = parser.parse_args() args = parser.parse_args()
# Set debug # Set debug
@ -131,6 +132,9 @@ def main():
item.update(labels=labels) item.update(labels=labels)
api.commit() api.commit()
if args.onetime:
break
logging.debug('Sleeping for %d seconds', args.delay) logging.debug('Sleeping for %d seconds', args.delay)
time.sleep(args.delay) time.sleep(args.delay)