diff --git a/alertaclient/commands/cmd_note.py b/alertaclient/commands/cmd_note.py index ac7e182..c469b39 100644 --- a/alertaclient/commands/cmd_note.py +++ b/alertaclient/commands/cmd_note.py @@ -4,15 +4,30 @@ @click.command('note', short_help='Add note') -@click.option('--ids', '-i', metavar='ID', multiple=True, help='List of note IDs') @click.option('--alert-ids', '-i', metavar='ID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @click.option('--filter', '-f', 'filters', metavar='FILTER', multiple=True, help='KEY=VALUE eg. serverity=warning resource=web') @click.option('--text', help='Note or message') -@click.option('--delete', '-D', metavar='ID', nargs=2, help='Delete note parent ID and note ID') +@click.option('--delete', '-D', metavar='ID', nargs=2, help='Delete note, using alert ID and note ID') @click.pass_obj -def cli(obj, ids, alert_ids, query, filters, text, delete): - """Add or delete note to alerts.""" +def cli(obj, alert_ids, query, filters, text, delete): + """ + Add or delete note to alerts. + + EXAMPLES + + Add a note to an alert. + + $ alerta note --alert-ids --text + + List notes for an alert. + + $ alerta notes --alert-ids + + Delete a note for an alert. + + $ alerta note -D + """ client = obj['client'] if delete: client.delete_alert_note(*delete) diff --git a/alertaclient/models/note.py b/alertaclient/models/note.py index 8718949..3979eef 100644 --- a/alertaclient/models/note.py +++ b/alertaclient/models/note.py @@ -40,12 +40,12 @@ def tabular(self, timezone=None): note = { 'id': self.id, 'text': self.text, + 'createTime': DateTime.localtime(self.create_time, timezone), 'user': self.user, # 'attributes': self.attributes, 'type': self.note_type, - 'createTime': DateTime.localtime(self.create_time, timezone), - 'updateTime': DateTime.localtime(self.update_time, timezone), 'related': self.alert, + 'updateTime': DateTime.localtime(self.update_time, timezone), 'customer': self.customer } return note