MCPcopy Create free account
hub / github.com/ejoffe/spr / readGhCLIConfig

Function readGhCLIConfig

github/githubclient/client.go:64–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func readGhCLIConfig() (*ghCLIConfig, error) {
65 homeDir, err := os.UserHomeDir()
66 if err != nil {
67 return nil, fmt.Errorf("failed to get user home directory: %w", err)
68 }
69
70 f, err := os.Open(path.Join(homeDir, ".config", "gh", "hosts.yml"))
71 if err != nil {
72 return nil, fmt.Errorf("failed to open gh cli config file: %w", err)
73 }
74
75 var cfg ghCLIConfig
76 if err := yaml.NewDecoder(f).Decode(&cfg); err != nil {
77 return nil, fmt.Errorf("failed to parse hub config file: %w", err)
78 }
79
80 return &cfg, nil
81}
82
83func findToken(githubHost string) string {
84 // Try environment variable first

Callers 1

findTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected