Fix active project + main func
This commit is contained in:
3
pits.py
3
pits.py
@@ -90,9 +90,12 @@ parser_action.set_defaults(func=handle_action)
|
|||||||
|
|
||||||
parser.add_argument('--version', action='version', version='%(prog)s 1.0')
|
parser.add_argument('--version', action='version', version='%(prog)s 1.0')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
last_action = read_last_action()
|
last_action = read_last_action()
|
||||||
logging.debug('Last action: {}'.format(last_action))
|
logging.debug('Last action: {}'.format(last_action))
|
||||||
|
|
||||||
args.func(args, last_action)
|
args.func(args, last_action)
|
||||||
|
|
||||||
|
print('END')
|
||||||
@@ -29,7 +29,10 @@ def handle_project(args, last_action):
|
|||||||
edit_project(args, args.edit_id)
|
edit_project(args, args.edit_id)
|
||||||
|
|
||||||
if not do_something:
|
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):
|
def create_project(args):
|
||||||
# TODO Project is same name is forbidden
|
# TODO Project is same name is forbidden
|
||||||
@@ -105,4 +108,4 @@ def list_project(active_project_id):
|
|||||||
nb_task = 0
|
nb_task = 0
|
||||||
current_project = ''
|
current_project = ''
|
||||||
if active_project_id and active_project_id == project_id: 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))
|
print('{:1} {:2d}: ({:8}) | {} | {} ({} tasks )'.format(current_project, project_id, username, status, name, nb_task))
|
||||||
Reference in New Issue
Block a user