def list_(args): states = args.states all_ = args.all format_ = args.format if states and finished: states.append('finished') def _filter(task_): if states and task_['state'] in states: return task_ elif not states and all_: return task_ elif not states and task_['state'] != 'finished': return task_ tasks = list(filter(_filter, task.all())) for task_ in tasks: _display_task(task_, format_=format_)
def migration_001(): for task_ in task.all(): task_['slug'] = task_.slug repo.put(task_.slug, task.dump(task_), 'Migration: 001')