├── LICENSE ├── gh-fzrepo └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sheepla 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gh-fzrepo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #readonly THIS_CMD="${0##*/}" 4 | readonly VERSION="0.0.1" 5 | readonly LICENSE="MIT" 6 | readonly GITHUB_URL="https://github.com" 7 | readonly AUTHOR="sheepla" 8 | 9 | readonly KEYBINDINGS="\ 10 | Ctrl+O open with browser 11 | Enter view README" 12 | 13 | function _version() { 14 | cat </dev/null &)" 81 | } 82 | 83 | _main "${@}" 84 | exit "${?}" 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🚀 gh-fzrepo 2 | 3 |
4 | 5 | 6 |
7 | 8 | An extension for [GitHub CLI](https://github.com/cli/cli) to browse repositories with fzf 9 | 10 | ## Demo on asciinema.org 11 | 12 | > [https://asciinema.org/a/435075](https://asciinema.org/a/435075) 13 | 14 | [![asciicast](https://asciinema.org/a/435075.svg)](https://asciinema.org/a/435075) 15 | 16 | ## Features 17 | 18 | - [x] Quickly browse the README of each repository 19 | - [x] Open URL of the repository in your default browser immediately 20 | 21 | ## Usage 22 | 23 | ``` 24 | gh fzrepo -- An extension for GitHub CLI to browse repositories with fzf 25 | 26 | USAGE 27 | gh fzrepo KEYWORDS... 28 | gh fzrepo -h|--help 29 | gh fzrepo -V|--version 30 | ``` 31 | 32 | ### Keybindings 33 | 34 | | key | function | 35 | |-----|----------| 36 | | `Ctrl+J`, `Ctrl+N` | move focus down | 37 | | `Ctrl+K`, `Ctrl+P` | move focus up | 38 | | `Enter` | view README with `gh repo view` | 39 | | `Ctrl+O` | open URL of the repository in your default browser | 40 | | `Esc`, `q` | quit fzf | 41 | 42 | ## Installation 43 | 44 | Dependences: 45 | 46 | - [GitHub CLI](https://github.com/cli/cli) v2.0.0+ 47 | - [junegunn/fzf](https://github.com/junegunn/fzf) 48 | 49 | ```bash 50 | gh extension install sheepla/gh-fzrepo 51 | ``` 52 | 53 | ## One Liner Edition 54 | 55 | ```bash 56 | query="..."; gh api "search/repositories?q=${query}" --jq ".items[].full_name" | fzf --preview "gh repo view {}" --bind "enter:execute(gh repo view {})" --bind "ctrl-o:execute(gh repo view -w {})" 57 | ``` 58 | 59 | ## Contribution 60 | 61 | Welcome! 62 | 63 | --------------------------------------------------------------------------------