node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

Listing with ability to specify the date formatting string #625

Closed bokchan closed 5 years ago

bokchan commented 5 years ago

In the list views the date is formatted as relative i.e.:

> gh is -M 40 -u username -S closed 

Listing closed issues on username/myrepo
#337 One patch @bokchan (a day ago)
.....
#333 Last patch @bokchan (a month ago)

The order/formatting of PR number, title, and github username can be manipulated with sed, but it could be really nice to be able to specify the formatting of the date, .e.g

> gh is -M 40 -u bokchan -S closed --date-format%Y-%m-%d

Listing closed issues on bokchan/myrepo
#337 One patch @bokchan (2019-02-10)
.....
#333 Last patch @bokchan (2018-01-10)
protoEvangelion commented 5 years ago

Hey @bokchan, right now we only have to views: detailed and non detailed. Can you give some examples of what you are looking to print out and not print out?

bokchan commented 5 years ago

Hi @protoEvangelion First of all, thanks for a great tool!

The question came up because I wanted to generate a changelog from a milestone which lists the datetime as relative

> gh is -M 40 -u bokchan -S closed 

Listing closed issues on bokchan/myrepo
#337 One patch @bokchan (a day ago)
.....
#333 Last patch @bokchan (a month ago)

The order/formatting of PR number, title, and github username can be manipulated with sed, but it could be really nice to be able to specify the formatting of the date, .e.g

> gh is -M 40 -u bokchan -S closed --date-format%Y-%m-%d

Listing closed issues on bokchan/myrepo
#337 One patch @bokchan (2019-02-10)
.....
#333 Last patch @bokchan (2018-01-10)
protoEvangelion commented 5 years ago

Thanks for the clarification. So we use moment for our date parsing. Would something like this work for you? https://momentjs.com/docs/#/displaying/format/

bokchan commented 5 years ago

Thanks for the clarification. So we use moment for our date parsing. Would something like this work for you? https://momentjs.com/docs/#/displaying/format/

If you mean the formatting capabilities offered by momentjs, then yes that would be more sufficient :)

I will change the title and description to make the issue clearer

protoEvangelion commented 5 years ago

@bokchan I just added the ability to pass in a formatter like gh is --date "ddd, hA" here: https://github.com/node-gh/gh/pull/626

It should also now work for all other list based cmds.

You can check it out by forking, cloning, then running:

gh pr 626 -u node-gh

and following instructions here to build and link it. Let me know if that achieves what you are looking for 😉

protoEvangelion commented 5 years ago

:tada: This PR is included in version 1.15.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: