|
3 | 3 | # python std lib |
4 | 4 | import re |
5 | 5 | import sys |
6 | | -from datetime import datetime |
7 | | -from pprint import pprint as pp |
8 | 6 |
|
9 | 7 | # 3rd party imports |
10 | 8 | from docopt import DocoptExit, Option, docopt, extras |
|
121 | 119 |
|
122 | 120 | sub_maniphest_show_args = """ |
123 | 121 | Usage: |
124 | | - phabfive maniphest show <ticket_id> ([--all] | [--pp]) [options] |
| 122 | + phabfive maniphest show <ticket_id> [options] |
125 | 123 |
|
126 | 124 | Arguments: |
127 | 125 | <ticket_id> Task ID (e.g., T123) |
128 | 126 |
|
129 | 127 | Options: |
130 | | - --all Show all fields for a ticket |
131 | | - --pp Show all fields rendering with pretty print |
| 128 | + --show-history Display transition history for columns, priority, and status |
| 129 | + --show-metadata Display metadata about the task |
132 | 130 | -h, --help Show this help message and exit |
133 | 131 | """ |
134 | 132 |
|
@@ -459,7 +457,7 @@ def run(cli_args, sub_args): |
459 | 457 | if cli_args["<command>"] == "maniphest": |
460 | 458 | maniphest_app = maniphest.Maniphest() |
461 | 459 |
|
462 | | - if sub_args["search"]: |
| 460 | + if sub_args.get("search"): |
463 | 461 | # Parse filter patterns if provided |
464 | 462 | transition_patterns = None |
465 | 463 | if sub_args.get("--column"): |
@@ -541,52 +539,18 @@ def run(cli_args, sub_args): |
541 | 539 | print("Ticket URI: {0}".format(ticket["uri"])) |
542 | 540 |
|
543 | 541 | if sub_args.get("show"): |
544 | | - _, result = maniphest_app.info(int(sub_args["<ticket_id>"][1:])) |
545 | | - |
546 | | - if sub_args["--pp"]: |
547 | | - pp({key: value for key, value in result.items()}) |
548 | | - elif sub_args["--all"]: |
549 | | - print(f"Ticket ID: {result['id']}") |
550 | | - print(f"phid: {result['phid']}") |
551 | | - print(f"authorPHID: {result['authorPHID']}") |
552 | | - print(f"ownerPHID: {result['ownerPHID']}") |
553 | | - print(f"ccPHIDs: {result['ccPHIDs']}") |
554 | | - print(f"status: {result['status']}") |
555 | | - print(f"statusName: {result['statusName']}") |
556 | | - print(f"isClosed: {result['isClosed']}") |
557 | | - print(f"priority: {result['priority']}") |
558 | | - print(f"priorityColor: {result['priorityColor']}") |
559 | | - print(f"title: {result['title']}") |
560 | | - print(f"description: {result['description']}") |
561 | | - print(f"projectPHIDs: {result['projectPHIDs']}") |
562 | | - print(f"uri: {result['uri']}") |
563 | | - print(f"auxiliary: {result['auxiliary']}") |
564 | | - print(f"objectName: {result['objectName']}") |
565 | | - |
566 | | - date_created = datetime.fromtimestamp(int(result["dateCreated"])) |
567 | | - print(f"dateCreated: {date_created}") |
568 | | - |
569 | | - date_modified = datetime.fromtimestamp(int(result["dateModified"])) |
570 | | - print(f"dateModified: {date_modified}") |
571 | | - |
572 | | - print(f"dependsOnTaskPHIDs: {result['dependsOnTaskPHIDs']}") |
573 | | - |
574 | | - # Display workboard transition history |
575 | | - task_phid = result.get("phid") |
576 | | - if task_phid: |
577 | | - maniphest_app._display_task_transitions(task_phid) |
578 | | - else: |
579 | | - print(f"Ticket ID: {result['id']}") |
580 | | - print(f"phid: {result['phid']}") |
581 | | - print(f"status: {result['status']}") |
582 | | - print(f"priority: {result['priority']}") |
583 | | - print(f"title: {result['title']}") |
584 | | - print(f"uri: {result['uri']}") |
585 | | - date_created = datetime.fromtimestamp(int(result["dateCreated"])) |
586 | | - print(f"dateCreated: {date_created}") |
587 | | - |
588 | | - date_modified = datetime.fromtimestamp(int(result["dateModified"])) |
589 | | - print(f"dateModified: {date_modified}") |
| 542 | + # Use new unified task_show() method |
| 543 | + task_id = int(sub_args["<ticket_id>"][1:]) |
| 544 | + |
| 545 | + # Handle flags |
| 546 | + show_history = sub_args.get("--show-history", False) |
| 547 | + show_metadata = sub_args.get("--show-metadata", False) |
| 548 | + |
| 549 | + maniphest_app.task_show( |
| 550 | + task_id, |
| 551 | + show_history=show_history, |
| 552 | + show_metadata=show_metadata, |
| 553 | + ) |
590 | 554 | except PhabfiveException as e: |
591 | 555 | # Catch all types of phabricator base exceptions |
592 | 556 | print(f"CRITICAL :: {str(e)}", file=sys.stderr) |
|
0 commit comments