mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.83k stars 2.2k forks source link

Auto-complete or show suggestions when tab is pressed in hub commands #871

Open haikyuu opened 9 years ago

haikyuu commented 9 years ago

It would be cool to auto-complete or show suggestions. For example: hub clone github/ + 2 * tab would list all the public repos of Github. And hub clone github/hu + tab would complete github/hub

mislav commented 9 years ago

It would be cool. However that would mean that your keystrokes would be triggering API requests and that you would have to wait for them to finish, making those autocompletions relatively slow? Are you sure this would be a good experience?

haikyuu commented 9 years ago

Yes, that's true. I think we should add a proper command for discovery.

For example hub discover github would print all the repos of Github and store their names in cache for proper auto-completion:

hub . . . . . . . . . . . . Hub helps you win at git. . . . . . . . . . . . . . . . . :star: 6,165 fork 554 source/fork gitignore . . . . . . . . A collection of useful .gitignore templates . . . . :star: 23,840 fork 8738 source/fork ...

hunterboerner commented 9 years ago

^ discovery command would be great.

isundaylee commented 9 years ago

So is anyone currently working on the discover command? If not, I can take it on! I'd really love that feature. Thanks :)

mislav commented 9 years ago

@isundaylee Not to my knowledge. Please explore how such a command could work. Note that our API library is go-octokit right now and that it might need contributing to as well to facilitate the feature of searching for repos.

haikyuu commented 9 years ago

@isundaylee i'd love to help. Let me know when you start working on it. Thanks

isundaylee commented 9 years ago

@haikyuu That'd be really great! I just spent some time learning Go and went ahead and added the basic functionality of listing all the repos of a given user (https://github.com/isundaylee/hub/commit/df93604bcba6e29f6891870f934ac6a1d7d96f3c). We should probably discuss a bit about how we want to present the information, as well as possibly caching the information somewhere so that we can later reuse them for completion.

isundaylee commented 9 years ago

So what information would we want in such a view? I'd assume repo name, # of forks, and # of stars. Anything else we might want?

Also do we have a standard way of outputting tabular output in hub?

mislav commented 9 years ago

@isundaylee I foresee that this shell completion feature would have two parts of implementation:

  1. The shell script that works with bash/zsh/other completion features to fetch and display options after the user presses Tab,
  2. The underlying command (proposed by @haikyuu) that would handle fetching this data and presenting it in machine-readable format (such as tab-delimited fields).
minademian commented 7 years ago

hi, did anything come of this discussion? i'd be keen on seeing this implemented. @isundaylee did you ever submit a pull request for this? I do realize this was a year ago, btw!

isundaylee commented 7 years ago

@minademian Hi! No I never ended up submitting a pull request for this. This was mostly because that at some point I stopped using hub as much as I used to. Sorry for that ):