diff --git a/src/pyelephant.py b/src/pyelephant.py index 2aca6e3..aec7c49 100755 --- a/src/pyelephant.py +++ b/src/pyelephant.py @@ -42,8 +42,12 @@ def show_by_id(session: sa.orm.Session, index: int): # ----------------------------------------------------------------------------- -def ls(session: sa.orm.Session): - for i in session.query(Task).order_by(Task.created_at): +def ls(session: sa.orm.Session, _all: False): + vals = session.query(Task).order_by(Task.created_at) + if _all is False: + vals = vals.filter(Task.active is True) + + for i in vals: show_by_obj(session, i) @@ -88,7 +92,8 @@ if __name__ == '__main__': show_parser.add_argument('index', type=int) ls_parser = subparsers.add_parser('ls') - ls_parser.set_defaults(func=ls) + ls_parser.set_defaults(func=ls, _all=False) + ls_parser.add_argument('--all', dest='_all', action='store_const', const='true', help="Show inactive tasks") args = parser.parse_args()