repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/artifact/oci/mock_client.go
pkg/cmd/attestation/artifact/oci/mock_client.go
package oci import ( "fmt" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/test/data" "github.com/google/go-containerregistry/pkg/name" v1 "github.com/google/go-containerregistry/pkg/v1" ) func makeTestAttestation() api.Attestation { return api.Attestation{Bundle: dat...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/artifact/oci/client_test.go
pkg/cmd/attestation/artifact/oci/client_test.go
package oci import ( "fmt" "testing" "github.com/google/go-containerregistry/pkg/name" v1 "github.com/google/go-containerregistry/pkg/v1" "github.com/google/go-containerregistry/pkg/v1/remote" "github.com/google/go-containerregistry/pkg/v1/remote/transport" "github.com/stretchr/testify/require" ) func TestGe...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/trustedroot/trustedroot.go
pkg/cmd/attestation/trustedroot/trustedroot.go
package trustedroot import ( "bytes" "encoding/json" "fmt" "net/http" "os" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/auth" "github.com/cli/cli/v2/pkg/cmd/attestation/io" "github.com/cli/cli/v2/pkg/cmd/attestation/verification" "github.com/cli/cli/v2/pkg/cmdut...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/trustedroot/trustedroot_test.go
pkg/cmd/attestation/trustedroot/trustedroot_test.go
package trustedroot import ( "bytes" "fmt" "net/http" "strings" "testing" "github.com/sigstore/sigstore-go/pkg/tuf" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" ghmock "github.com/cli/cli/v2/internal/...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/io/handler.go
pkg/cmd/attestation/io/handler.go
package io import ( "fmt" "strings" "github.com/cli/cli/v2/pkg/iostreams" "github.com/cli/cli/v2/utils" ) type Handler struct { ColorScheme *iostreams.ColorScheme IO *iostreams.IOStreams debugEnabled bool } func NewHandler(io *iostreams.IOStreams) *Handler { enabled, _ := utils.IsDebugEnabled() ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/metadata.go
pkg/cmd/attestation/download/metadata.go
package download import ( "encoding/json" "errors" "fmt" "os" "runtime" "strings" "github.com/cli/cli/v2/pkg/cmd/attestation/api" ) var ErrAttestationFileCreation = fmt.Errorf("failed to write attestations to file") type MetadataStore interface { createMetadataFile(artifactDigest string, attestationsResp []...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/metadata_test.go
pkg/cmd/attestation/download/metadata_test.go
package download import ( "bufio" "fmt" "os" "path" "runtime" "testing" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci" "github.com/stretchr/testify/require" ) type MockStore struct { OnCreateMet...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/options_test.go
pkg/cmd/attestation/download/options_test.go
package download import ( "fmt" "testing" "github.com/stretchr/testify/require" ) func TestAreFlagsValid(t *testing.T) { tests := []struct { name string limit int }{ { name: "Limit is too low", limit: 0, }, { name: "Limit is too high", limit: 1001, }, } for _, tc := range tests { ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/options.go
pkg/cmd/attestation/download/options.go
package download import ( "fmt" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci" "github.com/cli/cli/v2/pkg/cmd/attestation/io" ) const ( minLimit = 1 maxLimit = 1000 ) type Options struct { APIClient api.Client ArtifactPath string DigestAlgo...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/download_test.go
pkg/cmd/attestation/download/download_test.go
package download import ( "bytes" "fmt" "net/http" "runtime" "strings" "testing" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci" "github.com/cli/cli/v2/pkg/cmd/attestation/io" "github.com/cli/cli/v...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/attestation/download/download.go
pkg/cmd/attestation/download/download.go
package download import ( "errors" "fmt" "github.com/cli/cli/v2/pkg/cmd/attestation/api" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact" "github.com/cli/cli/v2/pkg/cmd/attestation/artifact/oci" "github.com/cli/cli/v2/pkg/cmd/attestation/auth" "github.com/cli/cli/v2/pkg/cmd/attestation/io" "github.com/cli...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/workflow.go
pkg/cmd/workflow/workflow.go
package workflow import ( cmdDisable "github.com/cli/cli/v2/pkg/cmd/workflow/disable" cmdEnable "github.com/cli/cli/v2/pkg/cmd/workflow/enable" cmdList "github.com/cli/cli/v2/pkg/cmd/workflow/list" cmdRun "github.com/cli/cli/v2/pkg/cmd/workflow/run" cmdView "github.com/cli/cli/v2/pkg/cmd/workflow/view" "github.c...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/list/list_test.go
pkg/cmd/workflow/list/list_test.go
package list import ( "bytes" "fmt" "io" "net/http" "testing" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/httpmock" "github.com/cli/cli/v2/pkg/iostreams" "github.com/google/shlex" "github.com/stretch...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/list/list.go
pkg/cmd/workflow/list/list.go
package list import ( "fmt" "net/http" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/tableprinter" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" ) const ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/view/view.go
pkg/cmd/workflow/view/view.go
package view import ( "fmt" "net/http" "net/url" "strings" "time" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/browser" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/tableprinter" "github.com/cli/cli/v2/internal/text" runShared "git...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/view/view_test.go
pkg/cmd/workflow/view/view_test.go
package view import ( "bytes" "io" "net/http" "testing" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/internal/browser" "github.com/cli/cli/v2/internal/ghrepo" runShared "github.com/cli/cli/v2/pkg/cmd/run/shared" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/run/run_test.go
pkg/cmd/workflow/run/run_test.go
package run import ( "bytes" "encoding/base64" "encoding/json" "fmt" "io" "net/http" "os" "testing" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/prompter" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.co...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/run/run.go
pkg/cmd/workflow/run/run.go
package run import ( "bytes" "encoding/json" "errors" "fmt" "io" "net/http" "reflect" "sort" "strings" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/disable/disable_test.go
pkg/cmd/workflow/disable/disable_test.go
package disable import ( "bytes" "io" "net/http" "testing" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/prompter" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/httpmock" "github.com/cli/cli/v2/pkg/iostreams" "github...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/disable/disable.go
pkg/cmd/workflow/disable/disable.go
package disable import ( "errors" "fmt" "net/http" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" ) type DisableOptions struct { HttpClient...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/enable/enable.go
pkg/cmd/workflow/enable/enable.go
package enable import ( "errors" "fmt" "net/http" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" ) type EnableOptions struct { HttpClient f...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/enable/enable_test.go
pkg/cmd/workflow/enable/enable_test.go
package enable import ( "bytes" "io" "net/http" "testing" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/prompter" "github.com/cli/cli/v2/pkg/cmd/workflow/shared" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/httpmock" "github.com/cli/cli/v2/pkg/iostreams" "github....
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/shared/shared_test.go
pkg/cmd/workflow/shared/shared_test.go
package shared import ( "errors" "fmt" "net/http" "net/url" "strings" "testing" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ghAPI "github.com/cli/go-gh/v2/pkg/api" ) fu...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/shared/shared.go
pkg/cmd/workflow/shared/shared.go
package shared import ( "bytes" "encoding/base64" "errors" "fmt" "io" "net/url" "path" "strconv" "strings" "github.com/cli/cli/v2/api" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/cli/go-gh/v2/pkg/asciisanitizer" "golang.o...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/workflow/shared/test.go
pkg/cmd/workflow/shared/test.go
package shared var AWorkflow = Workflow{ Name: "a workflow", ID: 123, Path: ".github/workflows/flow.yml", State: Active, } var AWorkflowContent = `{"content":"bmFtZTogYSB3b3JrZmxvdwo="}` var DisabledWorkflow = Workflow{ Name: "a disabled workflow", ID: 456, Path: ".github/workflows/disabled.yml", St...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/org/org.go
pkg/cmd/org/org.go
package org import ( "github.com/MakeNowJust/heredoc" orgListCmd "github.com/cli/cli/v2/pkg/cmd/org/list" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/spf13/cobra" ) func NewCmdOrg(f *cmdutil.Factory) *cobra.Command { cmd := &cobra.Command{ Use: "org <command>", Short: "Manage organizations", Long: "...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/org/list/list_test.go
pkg/cmd/org/list/list_test.go
package list import ( "bytes" "net/http" "testing" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/httpmock" "github.com/cli/cli/v2/pkg/iostreams" "github.com/google/shlex" "github.co...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/org/list/list.go
pkg/cmd/org/list/list.go
package list import ( "fmt" "net/http" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/internal/text" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" ) type ListOptions struct { IO *iostreams.IOStreams Co...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/org/list/http_test.go
pkg/cmd/org/list/http_test.go
package list import ( "net/http" "reflect" "testing" "github.com/cli/cli/v2/pkg/httpmock" ) func Test_listOrgs(t *testing.T) { type args struct { limit int } tests := []struct { name string args args httpStub func(*testing.T, *httpmock.Registry) wantErr bool }{ { name: "default", ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/org/list/http.go
pkg/cmd/org/list/http.go
package list import ( "net/http" "github.com/cli/cli/v2/api" ) type OrganizationList struct { Organizations []Organization TotalCount int User string } type Organization struct { Login string } func listOrgs(httpClient *http.Client, hostname string, limit int) (*OrganizationList, error) { type r...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/factory/remote_resolver.go
pkg/cmd/factory/remote_resolver.go
package factory import ( "errors" "fmt" "sort" "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/internal/ghinstance" "github.com/cli/cli/v2/pkg/set" "github.com/cli/go-gh/v2/pkg/ssh" ) const ( GH_HOST = "GH_HOST" ) type remoteResolver s...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/factory/default.go
pkg/cmd/factory/default.go
package factory import ( "context" "fmt" "net/http" "os" "regexp" "slices" "time" "github.com/cli/cli/v2/api" ghContext "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" "github.com/cli/cli/v2/internal/browser" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" "github...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/factory/default_test.go
pkg/cmd/factory/default_test.go
package factory import ( "net/http" "net/http/httptest" "net/url" "path/filepath" "testing" "github.com/cli/cli/v2/git" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" ghmock "github.com/cli/cli/v2/internal/gh/mock" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/factory/remote_resolver_test.go
pkg/cmd/factory/remote_resolver_test.go
package factory import ( "errors" "net/url" "testing" "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" ghmock "github.com/cli/cli/v2/internal/gh/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/requ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/completion/completion_test.go
pkg/cmd/completion/completion_test.go
package completion import ( "strings" "testing" "github.com/cli/cli/v2/pkg/iostreams" "github.com/google/shlex" "github.com/spf13/cobra" ) func TestNewCmdCompletion(t *testing.T) { tests := []struct { name string args string wantOut string wantErr string }{ { name: "no arguments", arg...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmd/completion/completion.go
pkg/cmd/completion/completion.go
package completion import ( "fmt" "github.com/MakeNowJust/heredoc" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" ) func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command { var shellType string cmd := &cobra.Command{ Use: "completion -s <shell>",...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/auth_check_test.go
pkg/cmdutil/auth_check_test.go
package cmdutil import ( "testing" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/gh" "github.com/spf13/cobra" "github.com/stretchr/testify/require" ) func Test_CheckAuth(t *testing.T) { tests := []struct { name string env map[string]string cfgStubs func(*testing.T, gh.C...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/flags.go
pkg/cmdutil/flags.go
package cmdutil import ( "context" "fmt" "strconv" "strings" "github.com/spf13/cobra" "github.com/spf13/pflag" ) // NilStringFlag defines a new flag with a string pointer receiver. This is useful for differentiating // between the flag being set to a blank value and the flag not being passed at all. func NilSt...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/repo_override.go
pkg/cmdutil/repo_override.go
package cmdutil import ( "os" "sort" "strings" "github.com/cli/cli/v2/internal/ghrepo" "github.com/spf13/cobra" ) func executeParentHooks(cmd *cobra.Command, args []string) error { for cmd.HasParent() { cmd = cmd.Parent() if cmd.PersistentPreRunE != nil { return cmd.PersistentPreRunE(cmd, args) } } ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/errors.go
pkg/cmdutil/errors.go
package cmdutil import ( "errors" "fmt" "github.com/AlecAivazis/survey/v2/terminal" ) // FlagErrorf returns a new FlagError that wraps an error produced by // fmt.Errorf(format, args...). func FlagErrorf(format string, args ...interface{}) error { return FlagErrorWrap(fmt.Errorf(format, args...)) } // FlagError...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/json_flags.go
pkg/cmdutil/json_flags.go
package cmdutil import ( "bytes" "encoding/json" "errors" "fmt" "io" "reflect" "sort" "strings" "github.com/cli/cli/v2/pkg/iostreams" "github.com/cli/cli/v2/pkg/jsoncolor" "github.com/cli/cli/v2/pkg/set" "github.com/cli/go-gh/v2/pkg/jq" "github.com/cli/go-gh/v2/pkg/template" "github.com/spf13/cobra" "g...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/json_flags_test.go
pkg/cmdutil/json_flags_test.go
package cmdutil import ( "bytes" "encoding/json" "fmt" "io" "testing" "time" "github.com/cli/cli/v2/pkg/iostreams" "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestAddJSONFlags(t *testing.T) { tests := []struct { name string fields ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/factory_test.go
pkg/cmdutil/factory_test.go
package cmdutil import ( "os" "path/filepath" "strings" "testing" ) func Test_executable(t *testing.T) { testExe, err := os.Executable() if err != nil { t.Fatal(err) } testExeName := filepath.Base(testExe) // Create 3 extra PATH entries that each contain an executable with the same name as the running te...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/args_test.go
pkg/cmdutil/args_test.go
package cmdutil import ( "errors" "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestMinimumArgs(t *testing.T) { tests := []struct { N int Args []string }{ { N: 1, Args: []string{"v1.2.3"}, }, { N: 2, Args: []str...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/cmdgroup.go
pkg/cmdutil/cmdgroup.go
package cmdutil import "github.com/spf13/cobra" func AddGroup(parent *cobra.Command, title string, cmds ...*cobra.Command) { g := &cobra.Group{ Title: title, ID: title, } parent.AddGroup(g) for _, c := range cmds { c.GroupID = g.ID parent.AddCommand(c) } }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/auth_check.go
pkg/cmdutil/auth_check.go
package cmdutil import ( "reflect" "github.com/cli/cli/v2/internal/gh" "github.com/spf13/cobra" "github.com/spf13/pflag" ) const skipAuthCheckAnnotation = "skipAuthCheck" func DisableAuthCheck(cmd *cobra.Command) { if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } cmd.Annotations[skipAut...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/factory.go
pkg/cmdutil/factory.go
package cmdutil import ( "net/http" "os" "path/filepath" "strings" "github.com/cli/cli/v2/context" "github.com/cli/cli/v2/git" "github.com/cli/cli/v2/internal/browser" "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/internal/prompter" "github.com/cli/cli/v...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/args.go
pkg/cmdutil/args.go
package cmdutil import ( "fmt" "path/filepath" "github.com/spf13/cobra" "github.com/spf13/pflag" ) func MinimumArgs(n int, msg string) cobra.PositionalArgs { if msg == "" { return cobra.MinimumNArgs(1) } return func(cmd *cobra.Command, args []string) error { if len(args) < n { return FlagErrorf("%s", ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/file_input.go
pkg/cmdutil/file_input.go
package cmdutil import ( "io" "os" ) func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error) { if filename == "-" { b, err := io.ReadAll(stdin) _ = stdin.Close() return b, err } return os.ReadFile(filename) }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/cmdutil/legacy.go
pkg/cmdutil/legacy.go
package cmdutil import ( "fmt" "os" "github.com/cli/cli/v2/internal/gh" ) // TODO: consider passing via Factory // TODO: support per-hostname settings func DetermineEditor(cf func() (gh.Config, error)) (string, error) { editorCommand := os.Getenv("GH_EDITOR") if editorCommand == "" { cfg, err := cf() if err...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/iostreams_test.go
pkg/iostreams/iostreams_test.go
package iostreams import ( "bufio" "fmt" "os" "testing" ) func TestStopAlternateScreenBuffer(t *testing.T) { ios, _, stdout, _ := Test() ios.SetAlternateScreenBufferEnabled(true) ios.StartAlternateScreenBuffer() fmt.Fprint(ios.Out, "test") ios.StopAlternateScreenBuffer() // Stopping a subsequent time shou...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/iostreams_progress_indicator_test.go
pkg/iostreams/iostreams_progress_indicator_test.go
//go:build !windows package iostreams import ( "fmt" "io" "os" "strings" "testing" "time" "github.com/Netflix/go-expect" "github.com/creack/pty" "github.com/hinshun/vt10x" "github.com/stretchr/testify/require" ) func TestStartProgressIndicatorWithLabel(t *testing.T) { osOut := os.Stdout defer func() { o...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/color_test.go
pkg/iostreams/color_test.go
package iostreams import ( "fmt" "testing" "github.com/stretchr/testify/assert" ) func TestLabel(t *testing.T) { tests := []struct { name string hex string text string wants string cs *ColorScheme }{ { name: "truecolor", hex: "fc0303", text: "red", wants: "\033[38;2;252;3;3mre...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/console.go
pkg/iostreams/console.go
//go:build !windows package iostreams import "os" func hasAlternateScreenBuffer(_ bool) bool { // on non-Windows, we just assume that alternate screen buffer is supported in most cases return os.Getenv("TERM") != "dumb" }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/color.go
pkg/iostreams/color.go
package iostreams import ( "fmt" "strconv" "strings" "github.com/mgutz/ansi" ) const ( NoTheme = "none" DarkTheme = "dark" LightTheme = "light" highlightStyle = "black:yellow" ) // Special cases like darkThemeTableHeader / lightThemeTableHeader are necessary when using color and modifiers //...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/epipe_other.go
pkg/iostreams/epipe_other.go
//go:build !windows package iostreams import ( "errors" "syscall" ) func isEpipeError(err error) bool { return errors.Is(err, syscall.EPIPE) }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/console_windows.go
pkg/iostreams/console_windows.go
//go:build windows package iostreams func hasAlternateScreenBuffer(hasTrueColor bool) bool { // on Windows we just assume that alternate screen buffer is supported if we // enabled virtual terminal processing, which in turn enables truecolor return hasTrueColor }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/iostreams.go
pkg/iostreams/iostreams.go
package iostreams import ( "bytes" "errors" "fmt" "io" "os" "os/exec" "os/signal" "strings" "sync" "time" "github.com/briandowns/spinner" ghTerm "github.com/cli/go-gh/v2/pkg/term" "github.com/cli/safeexec" "github.com/google/shlex" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" ) const ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/iostreams/epipe_windows.go
pkg/iostreams/epipe_windows.go
package iostreams import ( "errors" "syscall" ) func isEpipeError(err error) bool { // 232 is Windows error code ERROR_NO_DATA, "The pipe is being closed". return errors.Is(err, syscall.Errno(232)) }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/extensions/extension_mock.go
pkg/extensions/extension_mock.go
// Code generated by moq; DO NOT EDIT. // github.com/matryer/moq package extensions import ( "sync" ) // Ensure, that ExtensionMock does implement Extension. // If this is not the case, regenerate this file with moq. var _ Extension = &ExtensionMock{} // ExtensionMock is a mock implementation of Extension. // // f...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/extensions/extension.go
pkg/extensions/extension.go
package extensions import ( "io" "github.com/cli/cli/v2/internal/ghrepo" ) type ExtTemplateType int const ( GitTemplateType ExtTemplateType = 0 GoBinTemplateType ExtTemplateType = 1 OtherBinTemplateType ExtTemplateType = 2 ) //go:generate moq -rm -out extension_mock.go . Extension type Extension inter...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/extensions/manager_mock.go
pkg/extensions/manager_mock.go
// Code generated by moq; DO NOT EDIT. // github.com/matryer/moq package extensions import ( "github.com/cli/cli/v2/internal/ghrepo" "io" "sync" ) // Ensure, that ExtensionManagerMock does implement ExtensionManager. // If this is not the case, regenerate this file with moq. var _ ExtensionManager = &ExtensionMan...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/jsonfieldstest/jsonfieldstest.go
pkg/jsonfieldstest/jsonfieldstest.go
package jsonfieldstest import ( "strings" "testing" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/spf13/cobra" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func jsonFieldsFor(cmd *cobra.Command) []string { // This annotation is added by the `cmdutil.AddJSONFlags` function. /...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/option/option.go
pkg/option/option.go
// MIT License // Copyright (c) 2022 Tom Godkin // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merg...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/option/option_test.go
pkg/option/option_test.go
// MIT License // Copyright (c) 2022 Tom Godkin // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merg...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/ssh/ssh_keys.go
pkg/ssh/ssh_keys.go
package ssh import ( "errors" "fmt" "os" "os/exec" "path/filepath" "runtime" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/run" "github.com/cli/safeexec" ) type Context struct { configDir string keygenExe string } // NewContextForTests creates a new `ssh.Context` with internal p...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/findsh/find_windows.go
pkg/findsh/find_windows.go
package findsh import ( "os" "path/filepath" "github.com/cli/safeexec" ) func Find() (string, error) { shPath, shErr := safeexec.LookPath("sh") if shErr == nil { return shPath, nil } gitPath, err := safeexec.LookPath("git") if err != nil { return "", shErr } gitDir := filepath.Dir(gitPath) // regula...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/findsh/find.go
pkg/findsh/find.go
//go:build !windows package findsh import "os/exec" // Find locates the `sh` interpreter on the system. func Find() (string, error) { return exec.LookPath("sh") }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/jsoncolor/jsoncolor.go
pkg/jsoncolor/jsoncolor.go
package jsoncolor import ( "bytes" "encoding/json" "fmt" "io" "strings" ) const ( colorDelim = "1;38" // bright white colorKey = "1;34" // bright blue colorNull = "36" // cyan colorString = "32" // green colorBool = "33" // yellow ) type JsonWriter interface { Preface() []json.Delim } // Wr...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/jsoncolor/jsoncolor_test.go
pkg/jsoncolor/jsoncolor_test.go
package jsoncolor import ( "bytes" "io" "testing" "github.com/google/go-cmp/cmp" ) func TestWrite(t *testing.T) { type args struct { r io.Reader indent string } tests := []struct { name string args args wantW string wantErr bool }{ { name: "blank", args: args{ r: byt...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/httpmock/registry.go
pkg/httpmock/registry.go
package httpmock import ( "fmt" "net/http" "runtime/debug" "strings" "sync" "testing" ) // Replace http.Client transport layer with registry so all requests get // recorded. func ReplaceTripper(client *http.Client, reg *Registry) { client.Transport = reg } type Registry struct { mu sync.Mutex stubs ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/httpmock/stub.go
pkg/httpmock/stub.go
package httpmock import ( "bytes" "encoding/json" "io" "net/http" "net/url" "os" "regexp" "strings" "github.com/cli/go-gh/v2/pkg/api" ) type Matcher func(req *http.Request) bool type Responder func(req *http.Request) (*http.Response, error) type Stub struct { Stack string matched bool Matcher Ma...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/httpmock/legacy.go
pkg/httpmock/legacy.go
package httpmock import ( "fmt" ) // TODO: clean up methods in this file when there are no more callers func (r *Registry) StubRepoInfoResponse(owner, repo, branch string) { r.Register( GraphQL(`query RepositoryInfo\b`), StringResponse(fmt.Sprintf(` { "data": { "repository": { "id": "REPOID", "name": "...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/searcher_test.go
pkg/search/searcher_test.go
package search import ( "fmt" "net/http" "net/url" "strconv" "testing" "github.com/MakeNowJust/heredoc" fd "github.com/cli/cli/v2/internal/featuredetection" "github.com/cli/cli/v2/pkg/httpmock" "github.com/stretchr/testify/assert" ) func TestSearcherCode(t *testing.T) { query := Query{ Keywords: []string...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
true
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/result.go
pkg/search/result.go
package search import ( "encoding/json" "reflect" "strings" "time" "github.com/cli/cli/v2/pkg/cmdutil" ) var CodeFields = []string{ "path", "repository", "sha", "textMatches", "url", } var textMatchFields = []string{ "fragment", "matches", "type", "property", } var CommitFields = []string{ "author",...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/searcher_mock.go
pkg/search/searcher_mock.go
// Code generated by moq; DO NOT EDIT. // github.com/matryer/moq package search import ( "sync" ) // Ensure, that SearcherMock does implement Searcher. // If this is not the case, regenerate this file with moq. var _ Searcher = &SearcherMock{} // SearcherMock is a mock implementation of Searcher. // // func TestSo...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/searcher.go
pkg/search/searcher.go
package search import ( "encoding/json" "fmt" "io" "net/http" "net/url" "regexp" "strconv" "strings" fd "github.com/cli/cli/v2/internal/featuredetection" "github.com/cli/cli/v2/internal/ghinstance" ) const ( // GitHub API has a limit of 100 per page maxPerPage = 100 orderKey = "order" sortKey = "s...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/result_test.go
pkg/search/result_test.go
package search import ( "bytes" "encoding/json" "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestCodeExportData(t *testing.T) { tests := []struct { name string fields []string code Code output string }{ { name: "exports reque...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/query_test.go
pkg/search/query_test.go
package search import ( "testing" "github.com/stretchr/testify/assert" ) var trueBool = true func TestStandardSearchString(t *testing.T) { tests := []struct { name string query Query out string }{ { name: "empty query", out: "", }, { name: "converts query to string", query: Query{ ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/search/query.go
pkg/search/query.go
package search import ( "fmt" "reflect" "slices" "strings" "unicode" ) const ( KindRepositories = "repositories" KindCode = "code" KindIssues = "issues" KindCommits = "commits" ) type Query struct { // Keywords holds the list of keywords to search for. These keywords are // treated as i...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/githubtemplate/github_template.go
pkg/githubtemplate/github_template.go
package githubtemplate import ( "fmt" "io/fs" "os" "path" "regexp" "sort" "strings" "gopkg.in/yaml.v3" ) // FindNonLegacy returns the list of template file paths from the template folder (according to the "upgraded multiple template builder") func FindNonLegacy(rootDir string, name string) []string { result...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/githubtemplate/github_template_test.go
pkg/githubtemplate/github_template_test.go
package githubtemplate import ( "os" "path" "reflect" "testing" ) func TestFindNonLegacy(t *testing.T) { tmpdir, err := os.MkdirTemp("", "gh-cli") if err != nil { t.Fatal(err) } type args struct { rootDir string name string } tests := []struct { name string prepare []string args args ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/markdown/markdown.go
pkg/markdown/markdown.go
package markdown import ( "os" "strconv" "github.com/charmbracelet/glamour" ghMarkdown "github.com/cli/go-gh/v2/pkg/markdown" ) func WithoutIndentation() glamour.TermRendererOption { return ghMarkdown.WithoutIndentation() } // WithWrap is a rendering option that set the character limit for soft // wrapping the...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/set/string_set_test.go
pkg/set/string_set_test.go
package set import ( "testing" "github.com/stretchr/testify/assert" ) func Test_StringSlice_ToSlice(t *testing.T) { s := NewStringSet() s.Add("one") s.Add("two") s.Add("three") s.Add("two") assert.Equal(t, []string{"one", "two", "three"}, s.ToSlice()) } func Test_StringSlice_Remove(t *testing.T) { s := New...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/set/string_set.go
pkg/set/string_set.go
package set var exists = struct{}{} type stringSet struct { v []string m map[string]struct{} } func NewStringSet() *stringSet { s := &stringSet{} s.m = make(map[string]struct{}) s.v = []string{} return s } func (s *stringSet) Add(value string) { if s.Contains(value) { return } s.m[value] = exists s.v = ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/surveyext/editor_test.go
pkg/surveyext/editor_test.go
package surveyext import ( "bytes" "errors" "fmt" "os" "strings" "sync" "testing" "time" "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" pseudotty "github.com/creack/pty" "github.com/stretchr/testify/assert" ) func testLookPath(s string) ([]string, []string, error) { retur...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/surveyext/editor.go
pkg/surveyext/editor.go
package surveyext // This file extends survey.Editor to give it more flexible behavior. For more context, read // https://github.com/cli/cli/issues/70 // To see what we extended, search through for EXTENDED comments. import ( "os" "path/filepath" "runtime" "github.com/AlecAivazis/survey/v2" "github.com/AlecAiva...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/pkg/surveyext/editor_manual.go
pkg/surveyext/editor_manual.go
package surveyext import ( "bytes" "io" "os" "os/exec" "runtime" "github.com/cli/safeexec" shellquote "github.com/kballard/go-shellquote" ) type showable interface { Show() error } func Edit(editorCommand, fn, initialValue string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (string, error) { retur...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/cmd/gh/main.go
cmd/gh/main.go
package main import ( "os" "github.com/cli/cli/v2/internal/ghcmd" ) func main() { code := ghcmd.Main() os.Exit(int(code)) }
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/cmd/gen-docs/main_test.go
cmd/gen-docs/main_test.go
package main import ( "os" "strings" "testing" ) func Test_run(t *testing.T) { dir := t.TempDir() args := []string{"--man-page", "--website", "--doc-path", dir} err := run(args) if err != nil { t.Fatalf("got error: %v", err) } manPage, err := os.ReadFile(dir + "/gh-issue-create.1") if err != nil { t.Fa...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/cmd/gen-docs/main.go
cmd/gen-docs/main.go
package main import ( "fmt" "io" "os" "path/filepath" "strings" "github.com/cli/cli/v2/internal/config" "github.com/cli/cli/v2/internal/docs" "github.com/cli/cli/v2/internal/gh" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/cmd/root" "github.com/cli/cli/v2/pkg/cmdutil" "github.com/cli...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/test/helpers.go
test/helpers.go
package test import ( "bytes" "regexp" ) // TODO copypasta from command package type CmdOut struct { OutBuf *bytes.Buffer ErrBuf *bytes.Buffer BrowsedURL string } func (c CmdOut) String() string { return c.OutBuf.String() } func (c CmdOut) Stderr() string { return c.ErrBuf.String() } // OutputStub i...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/acceptance/acceptance_test.go
acceptance/acceptance_test.go
//go:build acceptance package acceptance_test import ( "fmt" "os" "path" "strconv" "strings" "testing" "time" "math/rand" "github.com/cli/cli/v2/internal/ghcmd" "github.com/cli/go-internal/testscript" ) func ghMain() int { return int(ghcmd.Main()) } func TestMain(m *testing.M) { os.Exit(testscript.Run...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/utils/utils.go
utils/utils.go
package utils import ( "fmt" "os" "golang.org/x/term" ) func IsDebugEnabled() (bool, string) { debugValue, isDebugSet := os.LookupEnv("GH_DEBUG") legacyDebugValue := os.Getenv("DEBUG") if !isDebugSet { switch legacyDebugValue { case "true", "1", "yes", "api": return true, legacyDebugValue default: ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/queries_projects_v2_test.go
api/queries_projects_v2_test.go
package api import ( "errors" "fmt" "sort" "strings" "testing" "unicode" "github.com/cli/cli/v2/internal/ghrepo" "github.com/cli/cli/v2/pkg/httpmock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestUpdateProjectV2Items(t *testing.T) { var tests = []struct { name ...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/queries_branch_issue_reference.go
api/queries_branch_issue_reference.go
package api import ( "fmt" "github.com/cli/cli/v2/internal/ghrepo" "github.com/shurcooL/githubv4" ) type LinkedBranch struct { BranchName string URL string } func CreateLinkedBranch(client *Client, host string, repoID, issueID, branchID, branchName string) (string, error) { var mutation struct { Crea...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/export_repo.go
api/export_repo.go
package api import ( "reflect" ) func (repo *Repository) ExportData(fields []string) map[string]interface{} { v := reflect.ValueOf(repo).Elem() data := map[string]interface{}{} for _, f := range fields { switch f { case "parent": data[f] = miniRepoExport(repo.Parent) case "templateRepository": data[f...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/queries_user.go
api/queries_user.go
package api type Organization struct { Login string } func CurrentLoginName(client *Client, hostname string) (string, error) { var query struct { Viewer struct { Login string } } err := client.Query(hostname, "UserCurrent", &query, nil) return query.Viewer.Login, err } func CurrentLoginNameAndOrgs(client...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/queries_pr.go
api/queries_pr.go
package api import ( "bytes" "encoding/json" "fmt" "net/http" "net/url" "time" "github.com/cli/cli/v2/internal/ghrepo" "github.com/shurcooL/githubv4" ) type PullRequestAndTotalCount struct { TotalCount int PullRequests []PullRequest SearchCapped bool } type PullRequestMergeable string const ( PullReq...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false
cli/cli
https://github.com/cli/cli/blob/c534a758887878331dda780aeb696b113f37b4ab/api/http_client.go
api/http_client.go
package api import ( "fmt" "io" "net/http" "strings" "time" "github.com/cli/cli/v2/utils" ghAPI "github.com/cli/go-gh/v2/pkg/api" ghauth "github.com/cli/go-gh/v2/pkg/auth" ) type tokenGetter interface { ActiveToken(string) (string, string) } type HTTPClientOptions struct { AppVersion string Cache...
go
MIT
c534a758887878331dda780aeb696b113f37b4ab
2026-01-07T08:35:47.579368Z
false