Gh-s - Search github repositories interactively

Overview



PR Go releases

search github repositories interactively

InstallationUsageFeedback

Search GitHub repositories interactively from the command line. Start the prompt, browse the results and open in the browser! The name of that repository 🤔 ? Written in rust, a list of awesome projects...

...well say no more:

gh s -l rust -d awesome

example_image

Installation

gh extension install gennaro-tedesco/gh-s

Usage

Get started!

gh s

demo

Without any argument (or with flags only) gh s starts a prompt to insert the search query; after the search a list of results is shown. Navigate the list to show details, stars counts, URL and more. If instead you want to do all in one line

gh s [search] [flag]

takes one of the following arguments or flags

flags description
-l, --lang narrow down the search to a specific language
-d, --desc search for keyword in the repository description
-u, --user restrict the search to a specific user
-c, --colour change colour of the prompt
-h, --help show the help page
-V, --version print the current version

The prompt accepts the following navigation commands:

key description
arrow keys browse results list
/ toggle search in results list
enter (<CR>) open selected repository in web browser

Feedback

If you find this application useful consider awarding it a , it is a great way to give feedback! Otherwise, any additional suggestions or merge request is warmly welcome!

See also a companion extension to snap around your git workflow: gh-f.

Comments
  • Feature Request: Search for (multiple) topics?

    Feature Request: Search for (multiple) topics?

    I like to search for multiple topics topic:go topic:ecs in addition to narrowing searches by language. It would be nice if there was a flag that could be specified multiple times.

    Thanks for a handy tool!

    enhancement 
    opened by StevenACoffman 8
  • Support

    Support "Code/Commit/Issues" Search

    Hi,

    I love your tool, very modern and intuitive, but it misses few things, like searching for code, commits, issues, users, etc...

    I'm currently using this one for searching code, very similar to your tool, but nodejs: https://github.com/feinoujc/gh-search-cli

    discussion 
    opened by jJit0 4
  • Limit results

    Limit results

    Description

    A QoL addition would be an extra flag to limit the number of results, as the options at the top are not always visible due to my small window size. I tried something, see the diff and GIF below for more clarity. I can open a PR, but open an issue first to get feedback on whether this is something you actually want to include in your project, and to ask if you even want to write the code yourself (I'm not a Go programmer, but it seems doable).

    Diff

    --- a/cmd/root.go
    +++ b/cmd/root.go
    @@ -28,6 +28,7 @@ var rootCmd = &cobra.Command{
     		user, _ := cmd.Flags().GetString("user")
     		topicList, _ := cmd.Flags().GetStringSlice("topic")
     		colour, _ := cmd.Flags().GetString("colour")
    +		limit, _ := cmd.Flags().GetInt("limit")
    
     		searchString := func() string {
     			if empty, _ := (cmd.Flags().GetBool("empty")); empty {
    @@ -45,7 +46,7 @@ var rootCmd = &cobra.Command{
     			fmt.Println("\033[31m ✘\033[0m No results found")
     			os.Exit(1)
     		}
    -		PromptList := getSelectionPrompt(repos, colour)
    +		PromptList := getSelectionPrompt(repos, colour, limit)
    
     		idx, _, err := PromptList.Run()
     		if err != nil {
    @@ -68,6 +69,7 @@ func init() {
     	rootCmd.Flags().StringP("user", "u", "", "search repository by user")
     	rootCmd.Flags().StringSliceVarP(&topics, "topic", "t", []string{}, "search repository by topic")
     	rootCmd.Flags().StringP("colour", "c", "cyan", "colour of selection prompt")
    +	rootCmd.Flags().IntP("limit", "L", 20, "Limit results")
     	rootCmd.Flags().BoolP("empty", "E", false, "allow for empty name search")
     	rootCmd.Flags().BoolP("version", "V", false, "print current version")
     	rootCmd.SetHelpTemplate(getRootHelp())
    @@ -126,6 +128,7 @@ Flags:
                     multiple topics can be specified:
                     -t go -t gh-extension
       -c, --colour  change prompt colour
    +  -L, --limit   Limit results
       -V, --version print current version
       -h, --help    show this help page
    
    --- a/cmd/ui.go
    +++ b/cmd/ui.go
    @@ -85,14 +85,14 @@ func getTemplate(colour string) *promptui.SelectTemplates {
    
     }
    
    -func getSelectionPrompt(repos []repoInfo, colour string) *promptui.Select {
    +func getSelectionPrompt(repos []repoInfo, colour string, limit int) *promptui.Select {
     	return &promptui.Select{
     		Stdout:    os.Stderr,
     		Stdin:     os.Stdin,
     		Label:     "repository list",
     		Items:     repos,
     		Templates: getTemplate(colour),
    -		Size:      20,
    +		Size:      limit,
     		Searcher: func(input string, idx int) bool {
     			repo := repos[idx]
     			title := strings.ToLower(repo.Name)
    
    

    GIF

    First the standard command gh s awesome and then with the additional -L flag.

    opened by LangLangBart 3
  • Flags lists

    Flags lists

    • added flags for lang and topic to handle lists of the type -l lang1 -l lang2 -t topic1 -t topic2
    • refactored a few functions for better readability
    • added new instructions in gh s --help and README.md
    opened by gennaro-tedesco 3
  • Suport darwin-arm64

    Suport darwin-arm64

    Resolves #2

    Goreleaser does not automatically generate release notes, so you will need to register your release in draft form and click the "Auto generate release-notes" button manually before publishing.

    image

    https://github.com/seachicken/gh-s/releases/tag/v1.0.0

    ref: https://goreleaser.com/ci/actions/#usage

    opened by seachicken 1
  • Allow to query against empty search string

    Allow to query against empty search string

    Following this discussion it can be useful to allow the user to skip the prompt for repository name and query against topic and language only.

    The idea is to implement a new flag, say -E, such that whenever such flag is passed, the query string defaults to empty name and we search against the rest of the flags only. Whilst this may result in very wide searches and therefore longer response times, it does allow for nice use cases of statistics and repository lists.

    enhancement 
    opened by gennaro-tedesco 1
  • Add Hotkey for Escaping/Resetting the Prompt

    Add Hotkey for Escaping/Resetting the Prompt

    Maybe good idea to bind Esc key to escape/reset the prompt? For example, the user might want to change the search term but there's no way to change it except to quit the command (e.g. using Ctrl-C).

    PS: Thanks for this nifty extension. :)

    enhancement 
    opened by ranelpadon 1
  • new flag to limit results

    new flag to limit results

    Description

    This PR aims to introduce a new flag (-L/ --limit) into this repo that allows the number of results to be limited. The name of the flag was derived from the gh tool, see image below for more clarity.

    Fix #17

    code quality

    The code was checked with .pre-commit-config.yaml and lintered with golangci-lint. See log outpul below for more clarity, the raised issue from the linter I have left in there for now, I can remove it if you like.

    ❯ git add . && git commit -m "new flag to limit results"
    go fmt...................................................................Passed
    go-unit-tests............................................................Passed
    go-build.................................................................Passed
    go-mod-tidy..............................................................Passed
    [limit a0d20e9] new flag to limit results
     3 files changed, 22 insertions(+), 18 deletions(-)
    ❯ golangci-lint run
    cmd/root.go:10:5: `cfgFile` is unused (deadcode)
    var cfgFile string
        ^
    

    note

    This is only the second time I have edited code in Go. Feel free to propose changes or commit the patch with your own changes.

    opened by LangLangBart 0
  • non-unicode `Active` selection

    non-unicode `Active` selection

    for now there is \U0001F449 used but it would be nice to have option to change this somehow for example through config, flag or environment variable

    it would be useful for those who don't have fonts with this unicode


    https://github.com/gennaro-tedesco/gh-s/blob/dd35856aa044749f1a857ee3ae0fd0bc21134ed2/cmd/ui.go#L76

    opened by dm9pZCAq 1
Releases(v0.0.7)
Owner
Gennaro Tedesco
Theoretical physicist and data scientist
Gennaro Tedesco
ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run, exec, cp, logs, stop)

English / 日本語 ecsk ECS + Task = ecsk ?? ecsk is a CLI tool to interactively use frequently used functions of docker command in Amazon ECS. (docker run

null 107 Aug 31, 2022
Deploy https certificates non-interactively to CDN services

certdeploy Deploy https certificates non-interactively to CDN services. Environment Variables CERT_PATH - Certificate file path, should contain certif

三三 1 Nov 12, 2021
Buildg: A tool to interactively debug Dockerfile

buildg: A tool to interactively debug Dockerfile buildg is a tool to interactively debug Dockerfile based on BuildKit. Source-level inspection Breakpo

Kohei Tokunaga 646 Sep 20, 2022
ghfs implements the io/fs interfaces for GitHub remote repositories.

ghfs implements the io/fs interfaces for GitHub remote repositories.

Ken’ichiro Oyama 1 Dec 15, 2021
Git-auto-push - Auto commit and push to github repositories

Auto commit and push to github repositories. How to use git clone https://github

Z.Q.K 3 Feb 5, 2022
Go-github-actions - `go-github-actions` is a package for developing GitHub Actions

go-github-actions go-github-actions is a package for developing GitHub Actions.

Ken’ichiro Oyama 1 Feb 6, 2022
A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Table of Contents Abstract Features Installation

Aqua Security 14k Sep 27, 2022
pr-bullet is a tool for copying pull request to multiple repositories.

pr-bullet pr-bullet is a tool for copying pull request to multiple repositories. Usage First, create original pull request ( ex. https://github.com/k1

Ken’ichiro Oyama 7 Apr 8, 2022
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Aleksandr Baryshnikov 51 Aug 23, 2022
Watchtower for Git: automatically keep local Git repositories up to date with their remotes

CrowsNest Watchtower for Git: automatically keep local Git repositories up to date with their remotes. Configuration Flags --run-once or -r: Normally

Simon 59 May 26, 2022
Go module for interacting with public ECR repositories

go-publicecr go-publicecr is a module for listing ECR image tags on a public ECR repository. Why go-publicecr The official Go SDK does not support int

Matthew Bamber 0 Nov 24, 2021
GitOops is a tool to help attackers and defenders identify lateral movement and privilege escalation paths in GitHub organizations by abusing CI/CD pipelines and GitHub access controls.

GitOops is a tool to help attackers and defenders identify lateral movement and privilege escalation paths in GitHub organizations by abusing CI/CD pipelines and GitHub access controls.

OVO Technology 596 Sep 9, 2022
github-actions-merger is github actions that merges pull request with commit message including pull request labels.

github-actions-merger github-actions-merger is github actions that merges pull request with commit message including pull request labels. Usage Write

ABEMA 6 Jun 14, 2022
A simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app to Docker Hub

go-pipeline-demo A repository containing a simple Go app and GitHub workflow that shows how to use GitHub Actions to test, build and deploy a Go app t

Marat Bogatyrev 0 Nov 17, 2021
Go-github-app - Template for building GitHub Apps in Go.

Template for GitHub Apps built with Golang Blog Posts - More Information About This Repo You can find more information about this project/repository a

Martin Heinz 50 Sep 22, 2022
Clones github projects into ~/Projects/github/{org}/{repo}

Tidy clone Github cli extension (gh extension) to clone repos into ~/Projects/github/{org}/{repo} on the local filesystem Install gh extension install

Pascal Welsch 1 Jan 19, 2022
Github billing exporter - Billing exporter for GitHub organizations

GitHub billing exporter Forked From: https://github.com/borisputerka/github_bill

Simon Schneider 3 Aug 31, 2022
Github-language-trends - Github trending languages API

Github trending languages API This API provides list of most popular github lang

Artur Veske 0 Feb 15, 2022
Beagle is a CLI written in Go to search for an specific username across the Internet.

Beagle __ \,--------/_/'--o Use beagle with /_ ___ /~" responsibility. /_/_/ /_/_/ ^^^^^^^^^^^^^^^^^^ Beagle is a CLI w

Daniel 30 Aug 3, 2022