Closed hamxabaig closed 5 years ago
Thanks for the Christmas present @hamxabaig 🎁 ! This is looking great. I will take a look 😄
Ah forgot to write @protoEvangelion Happy Christmas 🎄
Sure, let me know your thoughts when you review.
It looks fantastic! Nice job 😄 For the detailed flag however, some of the rows are not aligned properly.
For instance you can run: gh pr -u node-gh --detailed
Fixed it with:
renderer: new TerminalRenderer({
reflowText: true,
width: length
})
But is is still having problems with links when set like this [link](google.com)
Opened an issue here to fix the terminal text links: https://github.com/Automattic/cli-table/issues/118
You're right, its breaking with the links. Do you see something like this too?
When i output the content of body in separate file and cat
in terminal it shows fine. So i guess this is a problem with cli-table
Okay i removed the cli-table
package and used cli-table2
and it wraps them fine. Its rendering pretty nicely now:
Almost at the finish line!
As a frontend guy, I often think of "Is this responsive?". Though it works pretty well, at a certain point it becomes unusable (looks like about 75 cols).
I can think of two options:
process.stdout.colums < 75
then do not print as a table but print normally.Thoughts?
I think we can go with second option. We still have many options to make other layouts. Check this out I think maybe something like (its one column with multiple rows)
[pull_number | author | status]
[title]
[body]
[link]
As the number, status and author take less space so we can format in one row with many columns and rest can go with its own rows.
What do you think?
Yes I think that format is perfect! I pushed some commits that alter formatting a bit like making the #, status, author & date cols fixed and only the title col dynamic. Also modified the colors a little.
Let me know if that all still achieves what you are looking for.
Once you add the change for the responsive format we can go ahead and merge this 🎉
@protoEvangelion Yeah definitely. I'm gonna work on it, been a bit busy as our company's beta release is near 😄
PS: Happy New Year 🎉
@hamxabaig I just rebased on top of a refactor of TypeScript and fixed the merge conflicts.
Nothing will change for you except for getting to use cooler syntax, installing the new dependencies & running npm run build
or npm run build:watch
😄
Don't sweat writing types and all that. You can keep writing the JS you are used to 😉
Cool, It was so difficult for me to type all that var
stuff. I'm so used to ES6 😄
Haha I know how you feel! I'm workin on updating the syntax to es6 little by little and unesting the callback hell with async/await 🤞
I have tried playing with it but its being broken somehow with --detailed
tag
I think it finally works now. I used percentages to define colSpan
and it seems to be working fine. The mess up of table has something to do with the terminal being smaller. So i added some percentage to reduce the span.
Fantastic job on making this responsive! This is not a blocker but any idea why emojis might be breaking the columns in iTerm? I wasn't able to find anything that would cause that in the code or track down another issue like that on google.
Looks like it breaks every line there is an emoji
@protoEvangelion Yeah i think its because of the calculations done by the table component. The emojis take unkown space when rendered. They just calculate the table borders using text but when its really rendered it takes more space then before, thats why it breaks.
I bet if there is any solution to that. Its gonna be very hard.
The weird thing is it works in my VS Code editor which I normally use. But it's not a big deal and we can move forward.
I added labels and some formatting as well.
If that works for you and there is nothing else, give me the green light and I will merge this awesome PR!
Cool then lets merge so that people enjoy this listing format as much as i do 😄
Hmm Travis is failing with the gh pr --detailed
cmd but it is passing locally. I will debug and release this as soon as I can 😄
So the issue is somehow related to utf8 encoding. The table characters like https://graphemica.com/%E2%94%98 are represented with 3 bytes but utf8 encodes characters with 1 byte (8 bits).
Travis is printing out three replacement symbols which means it can't figure out the correct symbol.
This is a brand new arena for me so if you have any insight into encoding, please chime in 🙏
Hey, for me too 😄 However, I'll check on weekend if i can find anything.
:tada: This PR is included in version 1.14.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Wow that was challenging @hamxabaig . It ended up being that there were hidden ansi characters on Travis only! Anyways, thanks for your amazing work on this and incredible patience 🥇
This PR adds nice table formatting to pull requests list. I have used
cli-table
to show the list in the table. This feature is opt in and can be turned on by addingoutput: 'table'
in~/.gh.json
.I was not able to use
terminal-link
package to show links in the table. It has some weird bug, it won't show it as link. I have tried rendering it outside and it works but inside the table cell it doesn't work. I think it has something to do with thecli-table
encoding of strings.I have used some package to show the pull request's body nicely in the terminal. As the description might have markdown.
So with the final push, it looks like this (its with --detailed flag):
According to the discussions as per #589
https://github.com/tokilabs/gh/commit/dfc787a5fedb776cc22a3a7f4388767712b0e03b#diff-5b0afcc99bb531dfe82e0ff9b3d4b9bcR537