Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uphackday: gh repo garden #1049
hackday: gh repo garden #1049
Conversation
|
I would love to see this merged! I'm sorry for the late review. Since this is likely something that we would ship once and avoid refactoring too much, I think it would be beneficial if it was in its own package. Would you be open to moving the implementation to under |
|
SHA-mazing! If you're looking for an excuse to demo this, and/or watch a whole bunch of talks from fellow Roguelike developers and players, the Roguelike Celebration (usually hosted at GitHub HQ) might still be looking for presenters. I know the organizers well if you'd like an intro! Check out the videos from yesteryear on YouTube. |
|
@leereilly oh awesome! Thanks for suggesting that! I've watched videos from that event in the past. This is a humble little thing and I don't think I could spin it into a talk of any significant length. It might be suitable for a lightning talk; alternatively I can submit next time around once it's more fleshed out. |
|
@mislav sorry, I totally missed your review |
|
ok, this works fine on macos now |
Co-authored-by: Lee Reilly <lee@github.com>
|
Couple of minor points before this ships |
| } | ||
|
|
||
| func getResponse(client *http.Client, path string, data interface{}) (*http.Response, error) { | ||
| url := "https://api.github.com/" + path |
This comment has been minimized.
This comment has been minimized.
| // TODO fix arrow keys | ||
|
|
||
| func isLeft(b []byte) bool { | ||
| return bytes.EqualFold(b, []byte("a")) || bytes.EqualFold(b, []byte("q")) || bytes.EqualFold(b, []byte("h")) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
leereilly
Sep 9, 2020
•
Contributor
The only way I can exit (on macOS at least) seems to be CTRL C.
That seems acceptable / consistent with gh credits? Q doesn't work for me there either FWIW.
cli/pkg/cmd/repo/credits/credits.go
Line 190 in 5e11fe8
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mislav
Sep 11, 2020
•
Member
Sure! I was simply asking about q since it was documented as an exit technique for the garden.
Ctrl-C works, but does not print the nice exit message:
You turn and walk away from the wildflower garden…
| break | ||
| } | ||
|
|
||
| clear(opts.IO) |
This comment has been minimized.
This comment has been minimized.
mislav
Sep 9, 2020
Member
I realize that this would add some complexity, but is there a chance you could use cursor positioning to only redraw the 1–2 rows of the garden around the player's current position after a move (plus the status line in the bottom)? Redrawing the whole garden in iTerm2 for me makes the bottom few rows of the garden flicker for me, which is not a huge deal but it does make for a slightly worse experience, especially because it also causes the status line to flicker, which makes the text harder to read while I'm walking around.
This comment has been minimized.
This comment has been minimized.
vilmibm
Sep 10, 2020
Author
Member
the flickering is present in all platforms; only redrawing the current rows is a great improvement that i just haven't made time to do.
This comment has been minimized.
This comment has been minimized.
mislav
Sep 11, 2020
•
Member
Yeah, I realize how that delays the whole PR. Let's keep that as a potential improvement for later.
It's not that I feel very strongly that the garden always needs to render super smooth, but I think it would be valuable for us to learn how to position cursor in the terminal in general in case we ever need it in other commands or while redoing prompts in a more accessible manner.
| } | ||
|
|
||
| quitting := false | ||
| switch { |
This comment has been minimized.
This comment has been minimized.
mislav
Sep 9, 2020
Member
Could we add a default: case to this switch statement that just skips to the next loop iteration without redrawing the garden? That would avoid re-rendering the garden on invalid keystrokes such as arrow keys


vilmibm commentedMay 29, 2020
•
edited
For this hackday I wanted to create something interactive that was unique to a given repository. As
a big fan of games like Angband I decided to make a repository a top down thing that can be explored. I wanted to convey a sense of people coming together to make something that they couldn't do on their own, so I chose to render a repo's commits as a garden of colorful flowers. The color of each flower is the first 6 characters of a commit's SHA interpreted as a hex code; the character of each flower is the first letter of a commiter's GitHub handle.
In addition to the commit flowers, there's:
Considerations
utils.RGB(r,g,b,s)which can output text of any RGB color. I used this to more accurately convert SHAs to color and
also to make a gradient fill for the stream.
git logwhich is nice and fastbut this meant you couldn't generate a garden for an arbitrary repository; it also meant that
getting the GitHub handle for a committer was challenging. Using the API is a little slow but I'm
happier with the results.
Future directions
I'd like to render a much larger space that can be panned around while the user moves. Given a
larger space, I'd render more about a given repository: projects as monuments, closed issues as
graves, contributors as wandering NPCs, etc.
I'd also like to animate it when the user is standing still. Right now it only redraws when the user
moves. I want the stream to twinkle and the grass to move in the wind.