|
|
@@ -28,6 +28,12 @@ def item(ctx):
|
|
|
"""Handle items"""
|
|
|
ctx.obj['model'] = Item
|
|
|
|
|
|
+@main.group()
|
|
|
+@click.pass_context
|
|
|
+def comment(ctx):
|
|
|
+ """Handle comments"""
|
|
|
+ ctx.obj['model'] = Comment
|
|
|
+
|
|
|
def save_or_display_errors(model, data):
|
|
|
ok, m_doc = model.validate(data)
|
|
|
if ok :
|
|
|
@@ -108,6 +114,19 @@ def new_item(ctx, name, description, milestone_id=None, sprint_id=None, category
|
|
|
|
|
|
save_or_display_errors(model, data)
|
|
|
|
|
|
+@comment.command('new')
|
|
|
+@click.option('--item_id', prompt='ID of item on which to comment', type=int)
|
|
|
+@click.option('--text', prompt='Text', type=str)
|
|
|
+@click.pass_context
|
|
|
+def new_comment(ctx, item_id, text):
|
|
|
+ """Add a new comment"""
|
|
|
+ model = ctx.obj['model']
|
|
|
+ data = {
|
|
|
+ 'text': text,
|
|
|
+ 'item_id': item_id,
|
|
|
+ }
|
|
|
+ save_or_display_errors(model, data)
|
|
|
+
|
|
|
@click.command()
|
|
|
@click.pass_context
|
|
|
def list(ctx):
|