Make passing text on comment creation possible

It's now possible to pass the comment text in via CLI by passing using
the new `--text` option when creating comments. This increases
scriptability. Previously, it was only possible to add text in the
editor.
This commit is contained in:
MasterofJOKers 2024-05-31 22:12:26 +02:00
parent ead0cf51de
commit fe3d0fc5c6
1 changed files with 4 additions and 2 deletions

View File

@ -479,14 +479,16 @@ def comment():
@comment.command('create')
@click.option('--text', help="Text of the comment. Prompted for in editor if not provided.")
@pass_issue
@pass_client
def comment_create(client, issue):
def comment_create(client, issue, text):
"""Create a comment on the issue"""
# TODO add some help text for the syntax in the description
# TODO add all issue info to the description, so we can autocomplete in the
# editor
text = prompt(f"Comment text to add as new comment to {issue.key}")
if not text:
text = prompt(f"Comment text to add as new comment to {issue.key}")
client.add_comment(issue.key, text)