├── .gitignore
├── gh-i-logo.png
├── main.go
├── .pre-commit-config.yaml
├── .github
├── dependabot.yml
└── workflows
│ ├── release.yml
│ └── ci.yml
├── .goreleaser.yml
├── cmd
├── root_test.go
├── client.go
├── ui_test.go
├── root.go
└── ui.go
├── go.mod
├── README.md
├── go.sum
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | /gh-i
2 | /gh-i.exe
3 | dist
4 |
--------------------------------------------------------------------------------
/gh-i-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gennaro-tedesco/gh-i/HEAD/gh-i-logo.png
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "github.com/gennaro-tedesco/gh-i/cmd"
4 |
5 | func main() {
6 | cmd.Execute()
7 | }
8 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/dnephin/pre-commit-golang
3 | rev: v0.4.0
4 | hooks:
5 | - id: go-fmt
6 | - id: go-unit-tests
7 | - id: go-build
8 | - id: go-mod-tidy
9 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: 'github-actions'
4 | directory: '/'
5 | schedule:
6 | interval: 'monthly'
7 | open-pull-requests-limit: 3
8 | - package-ecosystem: 'gomod'
9 | directory: '/'
10 | schedule:
11 | interval: 'monthly'
12 | open-pull-requests-limit: 3
13 |
--------------------------------------------------------------------------------
/.goreleaser.yml:
--------------------------------------------------------------------------------
1 | before:
2 | hooks:
3 | - go mod tidy
4 | builds:
5 | - env:
6 | - CGO_ENABLED=0
7 | goos:
8 | - darwin
9 | - linux
10 | - windows
11 | - netbsd
12 | archives:
13 | - name_template: "{{ .Os }}-{{ .Arch }}"
14 | format: binary
15 | snapshot:
16 | name_template: "{{ .Tag }}-next"
17 | changelog:
18 | use: github-native
19 |
--------------------------------------------------------------------------------
/cmd/root_test.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "bytes"
5 | "regexp"
6 | "testing"
7 |
8 | "github.com/stretchr/testify/assert"
9 | )
10 |
11 | func TestVersionFlag(t *testing.T) {
12 | got := new(bytes.Buffer)
13 | rootCmd.SetOut(got)
14 | rootCmd.SetErr(got)
15 | rootCmd.SetArgs([]string{"--version"})
16 | err := rootCmd.Execute()
17 | if assert.NoError(t, err) {
18 | assert.Regexp(t, regexp.MustCompile(`^\d+\.\d+\.\d+(-\w+)?\n`), got.String())
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: release
2 | on:
3 | push:
4 | tags:
5 | - "v*"
6 |
7 | jobs:
8 | goreleaser:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@v4
13 | with:
14 | fetch-depth: 0
15 | - name: Set up Go
16 | uses: actions/setup-go@v5
17 | with:
18 | go-version-file: 'go.mod'
19 | cache-dependency-path: 'go.sum'
20 | - name: Run GoReleaser
21 | uses: goreleaser/goreleaser-action@v6
22 | with:
23 | distribution: goreleaser
24 | version: latest
25 | args: release --clean
26 | env:
27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | pull_request:
4 | workflow_dispatch:
5 |
6 | jobs:
7 | test:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout
11 | uses: actions/checkout@v4
12 | - name: Set up Go
13 | uses: actions/setup-go@v5
14 | with:
15 | go-version-file: 'go.mod'
16 | cache-dependency-path: 'go.sum'
17 | - run: go test ./...
18 | - run: go vet ./...
19 |
20 | build:
21 | runs-on: ubuntu-latest
22 | steps:
23 | - name: Checkout
24 | uses: actions/checkout@v4
25 | - name: Set up Go
26 | uses: actions/setup-go@v5
27 | with:
28 | go-version-file: 'go.mod'
29 | cache-dependency-path: 'go.sum'
30 | - name: Build
31 | run: |
32 | mkdir -p dist
33 | go build -v -o dist -race ./...
34 | - name: Smoke test
35 | run: |
36 | ./dist/gh-i --version
37 | ./dist/gh-i --help
38 |
--------------------------------------------------------------------------------
/cmd/client.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "log"
5 | "net/url"
6 |
7 | gh "github.com/cli/go-gh"
8 | )
9 |
10 | type issueInfo struct {
11 | Title string
12 | URL string
13 | State string
14 | Labels []interface{}
15 | UpdatedAt string
16 | }
17 |
18 | func getIssues(query url.Values) []issueInfo {
19 | client, err := gh.RESTClient(nil)
20 | if err != nil {
21 | log.Fatal(err)
22 | }
23 |
24 | var apiResults map[string]interface{}
25 | err = client.Get("search/issues?"+query.Encode(), &apiResults)
26 | if err != nil {
27 | log.Println("\033[31m ✘\033[0m Perhaps you misspelt the user -u?")
28 | log.Fatal(err)
29 | }
30 |
31 | itemsResults := apiResults["items"].([]interface{})
32 |
33 | var issues []issueInfo
34 | for _, item := range itemsResults {
35 | if item.(map[string]interface{})["pull_request"] == nil {
36 | issues = append(issues, issueInfo{
37 | Title: item.(map[string]interface{})["title"].(string),
38 | URL: item.(map[string]interface{})["html_url"].(string),
39 | State: item.(map[string]interface{})["state"].(string),
40 | Labels: item.(map[string]interface{})["labels"].([]interface{}),
41 | UpdatedAt: item.(map[string]interface{})["updated_at"].(string),
42 | })
43 | }
44 | }
45 | return issues
46 | }
47 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/gennaro-tedesco/gh-i
2 |
3 | go 1.23.3
4 |
5 | require (
6 | github.com/cli/go-gh v1.2.1
7 | github.com/jedib0t/go-pretty/v6 v6.4.6
8 | github.com/manifoldco/promptui v0.9.0
9 | github.com/spf13/cobra v1.8.1
10 | github.com/stretchr/testify v1.9.0
11 | golang.org/x/term v0.26.0
12 | )
13 |
14 | require (
15 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
16 | github.com/chzyer/readline v1.5.1 // indirect
17 | github.com/cli/safeexec v1.0.1 // indirect
18 | github.com/cli/shurcooL-graphql v0.0.3 // indirect
19 | github.com/davecgh/go-spew v1.1.1 // indirect
20 | github.com/henvic/httpretty v0.1.0 // indirect
21 | github.com/inconshreveable/mousetrap v1.1.0 // indirect
22 | github.com/kr/text v0.2.0 // indirect
23 | github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
24 | github.com/mattn/go-isatty v0.0.18 // indirect
25 | github.com/mattn/go-runewidth v0.0.14 // indirect
26 | github.com/muesli/termenv v0.15.1 // indirect
27 | github.com/pmezard/go-difflib v1.0.0 // indirect
28 | github.com/rivo/uniseg v0.4.4 // indirect
29 | github.com/spf13/pflag v1.0.5 // indirect
30 | github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
31 | golang.org/x/net v0.8.0 // indirect
32 | golang.org/x/sys v0.27.0 // indirect
33 | gopkg.in/yaml.v3 v3.0.1 // indirect
34 | )
35 |
--------------------------------------------------------------------------------
/cmd/ui_test.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/stretchr/testify/assert"
7 | )
8 |
9 | func TestParseInput(t *testing.T) {
10 | type testCase struct {
11 | inputValues map[string]interface{}
12 | trueString string
13 | }
14 | testCases := map[string]testCase{
15 | "skip to set repo if given empty": {
16 | inputValues: map[string]interface{}{
17 | "state": "open",
18 | "title": "support",
19 | "body": "body text",
20 | "user": "@me",
21 | "repo": "",
22 | "me": true,
23 | "labelsList": []string{"bug", "fix"},
24 | },
25 | trueString: "type:issue state:open support in:title body text in:body user:@me author:@me label:bug label:fix",
26 | },
27 |
28 | "set repo if specified": {
29 | inputValues: map[string]interface{}{
30 | "state": "open",
31 | "title": "support",
32 | "body": "body text",
33 | "user": "@me",
34 | "repo": "gennaro-tedesco/gh-f",
35 | "me": true,
36 | "labelsList": []string{"bug", "fix"},
37 | },
38 | trueString: "type:issue state:open support in:title body text in:body user:@me repo:gennaro-tedesco/gh-f author:@me label:bug label:fix",
39 | },
40 | }
41 |
42 | for description, testCase := range testCases {
43 | t.Run(description, func(t *testing.T) {
44 | inputValues := testCase.inputValues
45 |
46 | parsedString := parseInput(inputValues["state"].(string), inputValues["title"].(string), inputValues["body"].(string), inputValues["user"].(string), inputValues["repo"].(string), inputValues["me"].(bool), inputValues["labelsList"].([]string))
47 | assert.Equal(t, testCase.trueString, parsedString["q"][0])
48 | })
49 | }
50 | }
51 |
52 | func TestParseRepo(t *testing.T) {
53 | type testCase struct {
54 | input string
55 | ok bool
56 | want string
57 | errmsg string
58 | envs map[string]string
59 | }
60 |
61 | testCases := map[string]testCase{
62 | "given a valid format": {
63 | input: "gennaro-tedesco/gh-f",
64 | ok: true,
65 | want: "gennaro-tedesco/gh-f",
66 | },
67 | "given an invalid format": {
68 | input: "gh-i",
69 | ok: false,
70 | errmsg: `expected the "OWNER/REPO" format, got "gh-i"`,
71 | },
72 | "not given a repo but having only $GH_REPO": {
73 | input: "",
74 | ok: true,
75 | want: "",
76 | envs: map[string]string{
77 | "GH_REPO": "gennaro-tedesco/gh-f",
78 | },
79 | },
80 | "not given a repo but having both $GH_REPO and $GH_I_PREFER_REPO": {
81 | input: "",
82 | ok: true,
83 | want: "gennaro-tedesco/gh-f",
84 | envs: map[string]string{
85 | "GH_REPO": "gennaro-tedesco/gh-f",
86 | "GH_I_PREFER_REPO": "true",
87 | },
88 | },
89 | }
90 |
91 | for description, testCase := range testCases {
92 | t.Run(description, func(t *testing.T) {
93 | for name, value := range testCase.envs {
94 | t.Setenv(name, value)
95 | }
96 | got, err := parseRepo(testCase.input)
97 | ok := err == nil
98 | if ok != testCase.ok {
99 | assert.FailNow(t, "given an unexpected result")
100 | }
101 | if testCase.ok {
102 | assert.Equal(t, testCase.want, got)
103 | } else {
104 | assert.Equal(t, testCase.errmsg, err.Error())
105 | }
106 | })
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 | search your github issues interactively
20 |
25 |
26 | Search GitHub issues interactively from the command line. Where did you open that bug report three weeks ago? And how many feature requests are still open in your organisation 🤔?
27 |
28 | ...well say no more:
29 |
30 |
31 |
32 |
33 | ## Installation
34 | ```
35 | gh extension install gennaro-tedesco/gh-i
36 | ```
37 | This being a `gh` extension, you of course need [gh cli](https://github.com/cli/cli) as prerequisite.
38 |
39 | ## Usage
40 | Get started!
41 | ```
42 | gh i
43 | ```
44 |
45 | 
46 |
47 | Without any flags `gh i` shows all the issues created by yourself in order of last update: this is in the vast majority of cases what you are after, is it not? To refine the search, however, the following flags are available
48 | ```
49 | gh i [flag]
50 | ```
51 | takes one of the following arguments or flags
52 |
53 | | flags | description | example
54 | |:------------ |:------------------------------------------------ |:--------
55 | | --me | only show issues created by yourself | gh i --me=false
default to true
56 | | -s, --state | search issues by state (open, closed) | gh i -s closed
default to none, namely both
57 | | -t, --title | search for issue title | gh i -t bug-fix
58 | | -b, --body | search in issue body | gh i -b "not working"
59 | | -u, --user | search in repos owned by user only | gh i --me -u @me
60 | | -l, --label | search for issues by label | gh i -l bug -l fix (AND)
gh i -l bug,fix (OR)
61 | | -c, --colour | change colour of the prompt | gh i -c magenta
62 | | -h, --help | show the help page | gh i -h
63 | | -o, --output | print the output to console
default to false, namely open in the browser | gh i -u @me -o | xargs -n1 gh issue view
64 | | -V, --version| print the current version | gh i -V
65 |
66 | `gh-i` provides the user with visual output of the selected query in human readable format (according to the list of chosen flags):
67 | ```
68 | $ gh i -s open -u @me --me=false
69 | ╭──────────────────────────────────────────────╮
70 | │ state:open + author:any + where:your repos │
71 | ╰──────────────────────────────────────────────╯
72 | ...
73 | ```
74 | as well as inline overlay of issue status when browsing through the selection list.
75 |
76 | The prompt accepts the following navigation commands:
77 |
78 | | key | description
79 | |:------------- |:-----------------------------------
80 | | arrow keys | browse results list
81 | | `/` | toggle search in results list
82 | | `enter ()`| open issue in browser or return its URL as output (if `-o`)
83 |
84 | ### Execute commands
85 | `gh-i` must be intended as a filter, to browse the issues you created; as such, the best and most flexible way to execute commands with the results is to pipe it into and from `stdin/stdout`. This said, since in most cases one just wants to view and open the corresponding issue, we default to this action, namely upon selection the issue is opened in the web browser; to override this behaviour and return the output instead, use the `-o` flag.
86 |
87 | Check the [Wiki](https://github.com/gennaro-tedesco/gh-i/wiki) for more example and the most common use cases!
88 |
89 | ## Feedback
90 | 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!
91 |
92 | See also the complete family of extensions
93 | - [gh-s](https://github.com/gennaro-tedesco/gh-s) to search for repositories with interactive prompt
94 | - [gh-f](https://github.com/gennaro-tedesco/gh-f) to snap around your git workflow with `fzf`
95 |
96 |
--------------------------------------------------------------------------------
/cmd/root.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | gh "github.com/cli/go-gh"
8 | "github.com/spf13/cobra"
9 | )
10 |
11 | var cfgFile string
12 |
13 | // VERSION number: change manually
14 | const VERSION = "0.0.10"
15 |
16 | var rootCmd = &cobra.Command{
17 | Use: "gh-i",
18 | Short: "gh-i: search repositories interactively",
19 | Long: "gh-i: interactive prompt to search and browse github repositories",
20 | Args: cobra.MaximumNArgs(1),
21 | Run: func(cmd *cobra.Command, args []string) {
22 | version, _ := cmd.Flags().GetBool("version")
23 | if version {
24 | fmt.Fprintln(cmd.OutOrStdout(), VERSION)
25 | return
26 | }
27 | state, _ := cmd.Flags().GetString("state")
28 | title, _ := cmd.Flags().GetString("title")
29 | body, _ := cmd.Flags().GetString("body")
30 | user, _ := cmd.Flags().GetString("user")
31 | givenRepo, _ := cmd.Flags().GetString("repo")
32 | me, _ := cmd.Flags().GetBool("me")
33 | labelsList, _ := cmd.Flags().GetStringArray("label")
34 | colour, _ := cmd.Flags().GetString("colour")
35 | output, _ := cmd.Flags().GetBool("output")
36 |
37 | repo, err := parseRepo(givenRepo)
38 | if err != nil {
39 | fmt.Println(err)
40 | os.Exit(1)
41 | }
42 |
43 | if !output {
44 | explainInput(state, title, body, user, repo, me, labelsList, colour)
45 | }
46 | parsedQuery := parseInput(state, title, body, user, repo, me, labelsList)
47 |
48 | issues := getIssues(parsedQuery)
49 | if len(issues) == 0 {
50 | fmt.Println("\033[31m ✘\033[0m No results found")
51 | os.Exit(1)
52 | }
53 | PromptList := getSelectionPrompt(issues, colour)
54 |
55 | idx, _, err := PromptList.Run()
56 | if err != nil {
57 | fmt.Println(err)
58 | os.Exit(1)
59 | }
60 | if output {
61 | fmt.Println(issues[idx].Title)
62 | fmt.Println(issues[idx].URL)
63 | } else {
64 | args := []string{"issue", "view", issues[idx].URL, "-w"}
65 | _, _, err := gh.Exec(args...)
66 | if err != nil {
67 | fmt.Println(err)
68 | return
69 | }
70 | }
71 | },
72 | }
73 |
74 | func Execute() {
75 | cobra.CheckErr(rootCmd.Execute())
76 | }
77 |
78 | func init() {
79 | var labels []string
80 | rootCmd.Flags().Bool("me", true, "search issues you created")
81 | rootCmd.Flags().StringP("state", "s", "", "search by open or closed issues")
82 | rootCmd.Flags().StringP("title", "t", "", "search issue by title")
83 | rootCmd.Flags().StringP("body", "b", "", "search issue by body")
84 | rootCmd.Flags().StringP("user", "u", "", "search issue in repositories owned by user")
85 | rootCmd.Flags().StringP("repo", "r", "", "search in specified repository")
86 | rootCmd.Flags().StringArrayVarP(&labels, "label", "l", []string{}, "search issue by label")
87 | rootCmd.Flags().StringP("colour", "c", "cyan", "colour of selection prompt")
88 | rootCmd.Flags().BoolP("output", "o", false, "return issue html url to stdout instead of opening it")
89 | rootCmd.Flags().BoolP("version", "V", false, "print current version")
90 | rootCmd.SetHelpTemplate(getRootHelp())
91 | }
92 |
93 | func getRootHelp() string {
94 | return `
95 | gh-i: search your github issues interactively.
96 |
97 | Synopsis:
98 | gh i [flags]
99 |
100 | Usage:
101 | gh i
102 |
103 | if no arguments or flags are given, search the user's
104 | github issues across the web.
105 | After inputting the set of desired flags, the users gets
106 | visual confirmation of the search query in human readable format.
107 |
108 | Prompt commands:
109 |
110 | arrow keys : move up and down the list
111 | / : toggle fuzzy search
112 | enter (): open selected repository in the web browser
113 |
114 | Flags:
115 | --me boolean, only show issues created by yourself?
116 | -s, --state search issue by state: open or closed.
117 | Defaults to nothing, namely both
118 | -t, --title search for issue titles
119 | -b, --body search in issue body
120 | -u, --user search in repositories owned by specified user
121 | -r, --repo search in specified "OWNER/REPO" repository.
122 | if you turn on $GH_I_PREFER_REPO,
123 | Defaults to respecting $GH_REPO or $PWD
124 | -l, --label match specific issue labels
125 | comma separated --> OR (-l="bug,fix")
126 | many --> AND (-l=bug -l=fix)
127 | -c, --colour change prompt colour
128 | -o, --output boolean, whether to return the output to console
129 | (if you want to pipe it into something else).
130 | Default to false, namely open the issue in the browser
131 | -V, --version print current version
132 | -h, --help show this help page
133 |
134 | Examples:
135 |
136 | # search your latest opened issues anywhere
137 | gh i -s open
138 |
139 | # search your issues for a repository
140 | gh i -r your/repository
141 | cd ~/repositories/your/repository
142 | GH_I_PREFER_REPO=true gh i
143 |
144 | # search all issues in your own repositories
145 | gh i --me=false -u=@me
146 |
147 | # search the feature you requested long time ago
148 | gh i -l="feature,feature_request"
149 |
150 | # search by title and body
151 | gh i -l="bug" -t="upgrade" -b="new version breaks"
152 |
153 | # crete a new branch from issue
154 | gh -i -o | head -n1 | tr " " "-" | xargs -p -t git checkout -b
155 | `
156 | }
157 |
--------------------------------------------------------------------------------
/cmd/ui.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "fmt"
5 | "net/url"
6 | "os"
7 | "strings"
8 | "time"
9 |
10 | "github.com/cli/go-gh"
11 | "github.com/jedib0t/go-pretty/v6/table"
12 | "github.com/jedib0t/go-pretty/v6/text"
13 | "github.com/manifoldco/promptui"
14 | "golang.org/x/term"
15 | )
16 |
17 | func colourMap() map[string]text.Color {
18 | colourMap := map[string]text.Color{
19 | "black": text.FgBlack,
20 | "cyan": text.FgCyan,
21 | "green": text.FgGreen,
22 | "yellow": text.FgYellow,
23 | "blue": text.FgBlue,
24 | "magenta": text.FgMagenta,
25 | "red": text.FgRed,
26 | "white": text.FgWhite,
27 | }
28 | return colourMap
29 | }
30 |
31 | func explainInput(state string, title string, body string, user string, repo string, me bool, labelsList []string, colour string) {
32 | var queryString string
33 | if state == "" {
34 | queryString = queryString + fmt.Sprintf(" state:any +")
35 | } else {
36 | queryString = queryString + fmt.Sprintf(" state:%s +", state)
37 | }
38 | if me {
39 | queryString = queryString + fmt.Sprintf(" author:yourself +")
40 | } else {
41 | queryString = queryString + fmt.Sprintf(" author:any +")
42 | }
43 | if repo == "" {
44 | if user == "@me" {
45 | queryString = queryString + fmt.Sprintf(" where:your repos +")
46 | } else if user == "" {
47 | queryString = queryString + fmt.Sprintf(" where:anywhere +")
48 | } else {
49 | queryString = queryString + fmt.Sprintf(" where:repos by %s +", user)
50 | }
51 | } else {
52 | queryString = queryString + fmt.Sprintf(" where:repo is %s +", repo)
53 | }
54 |
55 | if title != "" {
56 | queryString = queryString + fmt.Sprintf(" title:match +")
57 | }
58 | if body != "" {
59 | queryString = queryString + fmt.Sprintf(" body:match +")
60 | }
61 | if len(labelsList) != 0 {
62 | queryString = queryString + fmt.Sprintf(" labels:")
63 | for _, label := range labelsList {
64 | queryString = queryString + fmt.Sprintf("%s ", label)
65 | }
66 | }
67 | queryString = strings.TrimSuffix(queryString, "+")
68 | queryString = strings.TrimSpace(queryString)
69 | t := createTable(colour)
70 | displayInput(t, queryString)
71 | t.AppendSeparator()
72 | t.Render()
73 | }
74 |
75 | func createTable(textColour string) table.Writer {
76 | t := table.NewWriter()
77 | t.SetOutputMirror(os.Stdout)
78 | t.SetStyle(table.StyleLight)
79 |
80 | width, _, _ := term.GetSize(0)
81 | t.SetColumnConfigs([]table.ColumnConfig{
82 | {Number: 1, WidthMax: 2 * width / 3},
83 | })
84 |
85 | if colour, ok := colourMap()[textColour]; ok {
86 | t.Style().Color.Row = text.Colors{colour}
87 | } else {
88 | t.Style().Color.Row = text.Colors{text.FgWhite}
89 | }
90 | t.Style().Options.SeparateColumns = false
91 | t.Style().Box.PaddingLeft = " "
92 | t.Style().Box.PaddingRight = " "
93 | t.Style().Box.BottomLeft = "╰"
94 | t.Style().Box.TopLeft = "╭"
95 | t.Style().Box.TopRight = "╮"
96 | t.Style().Box.BottomRight = "╯"
97 | return t
98 | }
99 |
100 | func displayInput(t table.Writer, queryString string) {
101 | t.AppendRow(table.Row{queryString})
102 | }
103 |
104 | func parseRepo(repo string) (string, error) {
105 | if repo == "" {
106 | if os.Getenv("GH_I_PREFER_REPO") != "" {
107 | currentRepo, err := gh.CurrentRepository()
108 | if err == nil {
109 | repo = currentRepo.Owner() + "/" + currentRepo.Name()
110 | }
111 | }
112 | }
113 | if repo != "" {
114 | fields := strings.SplitN(repo, "/", 2)
115 | if len(fields) != 2 {
116 | return "", fmt.Errorf(`expected the "OWNER/REPO" format, got %q`, repo)
117 | }
118 | for _, field := range fields {
119 | if len(field) == 0 {
120 | return "", fmt.Errorf(`expected the "OWNER/REPO" format, got %q`, repo)
121 | }
122 | }
123 | }
124 | return repo, nil
125 | }
126 |
127 | func parseInput(state string, title string, body string, user string, repo string, me bool, labelsList []string) url.Values {
128 | queryString := fmt.Sprint("type:issue")
129 | if state != "" {
130 | queryString = queryString + fmt.Sprintf(" state:%s", state)
131 | }
132 | if title != "" {
133 | queryString = queryString + fmt.Sprintf(" %s in:title", title)
134 | }
135 | if body != "" {
136 | queryString = queryString + fmt.Sprintf(" %s in:body", body)
137 | }
138 | if user != "" {
139 | queryString = queryString + fmt.Sprintf(" user:%s", user)
140 | }
141 | if repo != "" {
142 | queryString = queryString + fmt.Sprintf(" repo:%s", repo)
143 | }
144 | if me {
145 | queryString = queryString + fmt.Sprintf(" author:@me")
146 | }
147 | for _, label := range labelsList {
148 | queryString = queryString + fmt.Sprintf(" label:%s", label)
149 | }
150 | query := url.Values{}
151 | query.Add("q", queryString)
152 | query.Add("sort", "updated")
153 | query.Add("per_page", "100")
154 | return query
155 | }
156 |
157 | func getTemplate(colour string) *promptui.SelectTemplates {
158 | funcMap := promptui.FuncMap
159 | funcMap["parseLabels"] = func(Labels []interface{}) string {
160 | if len(Labels) == 0 {
161 | return ""
162 | }
163 | var concatLabels string
164 | for _, label := range Labels {
165 | concatLabels = concatLabels + fmt.Sprintf("%s, ", label.(map[string]interface{})["name"].(string))
166 | }
167 | return concatLabels[:len(concatLabels)-2]
168 | }
169 |
170 | funcMap["getRepoName"] = func(URL string) string {
171 | urlSlice := strings.Split(URL, "/")
172 | return urlSlice[3] + "/" + urlSlice[4]
173 | }
174 |
175 | funcMap["parseTimestamp"] = func(UpdatedAt string) string {
176 | t, _ := time.Parse("2006-01-02T15:04:05Z", UpdatedAt)
177 | return t.Format("2 Jan 2006 15:04:05")
178 | }
179 |
180 | return &promptui.SelectTemplates{
181 | Active: fmt.Sprintf("\U0001F449 {{ .Title | %s | bold }} {{ .State | faint }}", colour),
182 | Inactive: fmt.Sprintf(" {{ .Title | %s }}", colour),
183 | Selected: fmt.Sprintf(`{{ "✔" | green | bold }} {{ .Title | %s | bold }}`, colour),
184 | Details: `
185 | {{ "Repository:" | faint }} {{ .URL | getRepoName }}
186 | {{ "Url address:" | faint }} {{ .URL }}
187 | {{ "Labels:" | faint }} {{ .Labels | parseLabels }}
188 | {{ "Last updated:" | faint }} {{ .UpdatedAt | parseTimestamp }}
189 | `,
190 | }
191 |
192 | }
193 |
194 | func getSelectionPrompt(issues []issueInfo, colour string) *promptui.Select {
195 | return &promptui.Select{
196 | Stdout: os.Stderr,
197 | Stdin: os.Stdin,
198 | Label: "repository list",
199 | Items: issues,
200 | Templates: getTemplate(colour),
201 | Size: 20,
202 | Searcher: func(input string, idx int) bool {
203 | repo := issues[idx]
204 | title := strings.ToLower(repo.Title)
205 |
206 | return strings.Contains(title, input)
207 | },
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
2 | github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
3 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
4 | github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
5 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
6 | github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
7 | github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
8 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
9 | github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
10 | github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
11 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
12 | github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
13 | github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
14 | github.com/cli/go-gh v1.2.1 h1:xFrjejSsgPiwXFP6VYynKWwxLQcNJy3Twbu82ZDlR/o=
15 | github.com/cli/go-gh v1.2.1/go.mod h1:Jxk8X+TCO4Ui/GarwY9tByWm/8zp4jJktzVZNlTW5VM=
16 | github.com/cli/safeexec v1.0.1 h1:e/C79PbXF4yYTN/wauC4tviMxEV13BwljGj0N9j+N00=
17 | github.com/cli/safeexec v1.0.1/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
18 | github.com/cli/shurcooL-graphql v0.0.3 h1:CtpPxyGDs136/+ZeyAfUKYmcQBjDlq5aqnrDCW5Ghh8=
19 | github.com/cli/shurcooL-graphql v0.0.3/go.mod h1:tlrLmw/n5Q/+4qSvosT+9/W5zc8ZMjnJeYBxSdb4nWA=
20 | github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
21 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
22 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
23 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
24 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
25 | github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
26 | github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
27 | github.com/henvic/httpretty v0.1.0 h1:Htk66UUEbXTD4JR0qJZaw8YAMKw+9I24ZZOnDe/ti+E=
28 | github.com/henvic/httpretty v0.1.0/go.mod h1:ViEsly7wgdugYtymX54pYp6Vv2wqZmNHayJ6q8tlKCc=
29 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
30 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
31 | github.com/jedib0t/go-pretty/v6 v6.4.6 h1:v6aG9h6Uby3IusSSEjHaZNXpHFhzqMmjXcPq1Rjl9Jw=
32 | github.com/jedib0t/go-pretty/v6 v6.4.6/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs=
33 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
34 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
35 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
36 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
37 | github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
38 | github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
39 | github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
40 | github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
41 | github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
42 | github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
43 | github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
44 | github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
45 | github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
46 | github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
47 | github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
48 | github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
49 | github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
50 | github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
51 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
52 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
53 | github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
54 | github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
55 | github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
56 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
57 | github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
58 | github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
59 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
60 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
61 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
62 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
63 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
64 | github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
65 | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
66 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
67 | github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e h1:BuzhfgfWQbX0dWzYzT1zsORLnHRv3bcRcsaUk0VmXA8=
68 | github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI=
69 | github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
70 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
71 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
72 | golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
73 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
74 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
75 | golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
76 | golang.org/x/net v0.0.0-20220923203811-8be639271d50/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
77 | golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
78 | golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
79 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
80 | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
81 | golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
82 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
83 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
84 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
85 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
86 | golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
87 | golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
88 | golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
89 | golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
90 | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
91 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
92 | golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
93 | golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
94 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
95 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
96 | golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
97 | golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
98 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
99 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
100 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
101 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
102 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
103 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
104 | golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
105 | golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
106 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
107 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
108 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
109 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
110 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
111 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
112 | gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
113 | gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
114 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
115 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
116 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
117 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------