diff --git a/pits.py b/pits.py index 654027e..eef3bed 100644 --- a/pits.py +++ b/pits.py @@ -90,9 +90,12 @@ parser_action.set_defaults(func=handle_action) parser.add_argument('--version', action='version', version='%(prog)s 1.0') -args = parser.parse_args() +if __name__ == '__main__': + args = parser.parse_args() -last_action = read_last_action() -logging.debug('Last action: {}'.format(last_action)) + last_action = read_last_action() + logging.debug('Last action: {}'.format(last_action)) -args.func(args, last_action) \ No newline at end of file + args.func(args, last_action) + + print('END') \ No newline at end of file diff --git a/project.py b/project.py index 06e8d70..9955a4d 100644 --- a/project.py +++ b/project.py @@ -29,7 +29,10 @@ def handle_project(args, last_action): edit_project(args, args.edit_id) if not do_something: - list_project(last_action[0]) + active_project_id = None + if last_action: + active_project_id = last_action[0] + list_project(active_project_id) def create_project(args): # TODO Project is same name is forbidden @@ -105,4 +108,4 @@ def list_project(active_project_id): nb_task = 0 current_project = '' if active_project_id and active_project_id == project_id: current_project = '*' - print('{:1} {:2d}: ({:16}) | {} | {} ({} tasks )'.format(current_project, project_id, username, status, name, nb_task)) \ No newline at end of file + print('{:1} {:2d}: ({:8}) | {} | {} ({} tasks )'.format(current_project, project_id, username, status, name, nb_task)) \ No newline at end of file