Compare commits

..

No commits in common. "f0b455326eab799705f9ff8b36d588b9189f7e08" and "68b1142cd7b33f406fc5f4d078d688b847a6dcf4" have entirely different histories.

2 changed files with 2 additions and 64 deletions

View File

@ -411,8 +411,7 @@ def label_edit(issue):
@issue.command()
@pass_issue
@pass_client
def debug(client, issue):
def debug(issue):
import IPython
IPython.embed()
@ -466,68 +465,8 @@ def show(client, issue):
for i, comment in enumerate(issue.fields.comment.comments):
if i != 0:
print('')
print(f" {comment.created} - {comment.author} - {comment.id}")
print(f" {comment.created} - {comment.author}")
body = indent('\n'.join(wrap(comment.body, replace_whitespace=False)), ' ' * 4)
print(body)
print('')
@issue.group()
def comment():
pass
@comment.command('create')
@pass_issue
@pass_client
def comment_create(client, issue):
"""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}")
client.add_comment(issue.key, text)
def get_comment(client, issue, comment_id):
if not comment_id:
from clintermission import cli_select_item
options = []
for comment in issue.fields.comment.comments:
# TODO make this roughly terminal width or add a shorten() method
# with … at the end
body = comment.body.replace('\n', ' ')[:64]
options.append((f"{comment.created} - {comment.author} - {body}", comment.id))
_, comment_id = cli_select_item(options)
return client.comment(issue.key, comment_id, expand=['body'])
@comment.command('edit')
@click.argument('comment_id', required=False)
@pass_issue
@pass_client
def comment_edit(client, issue, comment_id):
"""Edit the text of an issues comment"""
comment = get_comment(client, issue, comment_id)
text = prompt(f"Comment text to set as new body for comment {comment_id} on {issue.key}",
initial_content=comment.body)
if text == comment.body:
print("No changes. Aborting.")
return
comment.update(body=text)
@comment.command('delete')
@click.argument('comment_id', required=False)
@pass_issue
@pass_client
def comment_delete(client, issue, comment_id):
comment = get_comment(client, issue, comment_id)
# TODO print formatted comment for verification
click.confirm("Do you really want to delete this ^ ?", abort=True)
comment.delete()

View File

@ -7,7 +7,6 @@ description = JIRA command line interface
packages = find:
install_requires =
click
clintermission
python-editor
jira
pyaml