|
@@ -76,19 +76,36 @@ def new_sprint(ctx, name, description, milestone_id):
|
|
|
def new_item(ctx, name, description, milestone_id=None, sprint_id=None, category=None):
|
|
def new_item(ctx, name, description, milestone_id=None, sprint_id=None, category=None):
|
|
|
"""Add a new sprint"""
|
|
"""Add a new sprint"""
|
|
|
model = ctx.obj['model']
|
|
model = ctx.obj['model']
|
|
|
- data = {}
|
|
|
|
|
|
|
+
|
|
|
if not milestone_id and not sprint_id:
|
|
if not milestone_id and not sprint_id:
|
|
|
parent_type = click.prompt('Related to [M]ilestone or [S]print ?', type=click.Choice(['m', 's']))
|
|
parent_type = click.prompt('Related to [M]ilestone or [S]print ?', type=click.Choice(['m', 's']))
|
|
|
if parent_type == 'm':
|
|
if parent_type == 'm':
|
|
|
milestone_id = click.prompt('Related milestone ID', type=int)
|
|
milestone_id = click.prompt('Related milestone ID', type=int)
|
|
|
elif parent_type == 's':
|
|
elif parent_type == 's':
|
|
|
sprint_id = click.prompt('Related sprint ID', type=int)
|
|
sprint_id = click.prompt('Related sprint ID', type=int)
|
|
|
|
|
+
|
|
|
|
|
+ if not category:
|
|
|
|
|
+ choices = {
|
|
|
|
|
+ 'limitation': 'l',
|
|
|
|
|
+ 'feature': 'f',
|
|
|
|
|
+ 'constraint': 'c',
|
|
|
|
|
+ 'unknown': 'u'
|
|
|
|
|
+ }
|
|
|
|
|
+ category_choice = click.prompt(
|
|
|
|
|
+ 'Which category ? ({})'.format(', '.join(choices.keys())),
|
|
|
|
|
+ type=click.Choice([v for v in choices.values()])
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ inv_choices = {v: k for k, v in choices.items()}
|
|
|
|
|
+ category = inv_choices[category_choice]
|
|
|
|
|
+
|
|
|
|
|
+ data = {'name': name, 'description': description, 'category': category}
|
|
|
|
|
+
|
|
|
if milestone_id:
|
|
if milestone_id:
|
|
|
- data = {'milestone_id': milestone_id}
|
|
|
|
|
|
|
+ data.update({'milestone_id': milestone_id})
|
|
|
if sprint_id:
|
|
if sprint_id:
|
|
|
- data = {'sprint_id': sprint_id}
|
|
|
|
|
|
|
+ data.update({'sprint_id': sprint_id})
|
|
|
|
|
|
|
|
- data.update({'name': name, 'description': description, 'category': category})
|
|
|
|
|
save_or_display_errors(model, data)
|
|
save_or_display_errors(model, data)
|
|
|
|
|
|
|
|
@click.command()
|
|
@click.command()
|