Skip to content

Enhancing JSON formatting for project functionality #7572

Description

@kamaz

Describe the feature or problem you’d like to solve

I really like the new feature of being able to use the cli tool with the project functionality. However, it would be quite helpful to add a title property in some areas of the response when using json formatting, especially for the iteration and milestone fields.

Proposed solution

When following command is used:

/usr/local/bin/gh project item-list 1 --owner "<owner>" --limit 1000 --format json | jq '.items'

It produces the following JSON output::

{
    "id": "PVTI_lADOBsQO_s4AGj6izgGwNWE",
     ...
    "milestone": {
      "description": "very long description for milestone",
      "dueOn": ""
    },
    // sprint field is an example of iteration field 
    "sprint": {
      "startDate": "2023-07-01",
      "duration": 28
    },
  },

In my opinion, it would be beneficial to include a title property with a corresponding value for the milestone and iteration fields. This would allow for easier filtering using tools like jq instead of relying solely on the description which can be long and hard to use with other tools. For example:

{
    "id": "PVTI_lADOBsQO_s4AGj6izgGwNWE",
     ...
    "milestone": {
      "description": "very long description for milestone",
      "dueOn": "",
      // proposed new field "title"
      "title": "beta-1"
    },
     // sprint field is an example of iteration field 
    "sprint": {
      "startDate": "2023-07-01",
      "duration": 28,
      // proposed new field "title"
      "title": "beta-1"
    },
  },

Please note that the above solution assumes the inclusion of a title property in the JSON response for both the milestone and iteration fields.

Activity

  1. samcoe commented on Jun 21, 2023

    @samcoe
    Contributor

    @kamaz Thanks for writing in. This feature makes sense to me, going to open it up for community contributions.

  2. added and removed on Jun 21, 2023
  3. kamaz commented on Jun 21, 2023

    @kamaz
    ContributorAuthor

    @samcoe happy to help and extend the functionality

  4. kamaz commented on Jun 23, 2023

    @kamaz
    ContributorAuthor

    @samcoe I've created a PR, but I noticed that there is a lack of tests that would cover the functionality in this area. Do you want me to add them, or are there plans to add them in the near future?

  5. samcoe commented on Jun 25, 2023

    @samcoe
    Contributor

    @kamaz Sure, if you wouldn't mind extending the current test that would be great.

  6. kamaz commented on Jun 28, 2023

    @kamaz
    ContributorAuthor

    @samcoe added tests and I believe it is ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions