Skip to content

Execute commands

Gennaro Tedesco edited this page Jan 30, 2022 · 6 revisions

gh-s must be intended as a filter prompt returning the URL of the selection; as such, the best and most flexible way to execute commands with the results is to pipe it into and from stdin/stdout.

Since gh-s returns a string as output, the easiest way to handle it is to serve to xargs: some most common use cases

# fetch the README in your terminal
gh s neovim -l lua | xargs -n1 gh repo view
# open the URL in the browser
gh s neovim -l lua | xargs -n1 gh browse -R
# find that issue you opened long time ago
gh s ripgrep -l rust -u BurntSushi | xargs -n1 gh issue list -s"all" -A @me -R
# clone this repo and send a PR!
gh s gh-s -u gennaro-tedesco | xargs -n1 gh repo clone
# install gh extensions 
gh s -E -t gh-extension | xargs -n1 gh extension install
pipe_demo

...do you know of more 🤔? Contribute!

Clone this wiki locally