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

Function readHubCLIConfig

github/githubclient/client.go:38–55  ·  view source on GitHub ↗

readHubCLIConfig finds and deserialized the config file for Github's "hub" CLI (https://hub.github.com/).

()

Source from the content-addressed store, hash-verified

36// readHubCLIConfig finds and deserialized the config file for
37// Github's "hub" CLI (https://hub.github.com/).
38func readHubCLIConfig() (hubCLIConfig, error) {
39 homeDir, err := os.UserHomeDir()
40 if err != nil {
41 return nil, fmt.Errorf("failed to get user home directory: %w", err)
42 }
43
44 f, err := os.Open(path.Join(homeDir, ".config", "hub"))
45 if err != nil {
46 return nil, fmt.Errorf("failed to open hub config file: %w", err)
47 }
48
49 var cfg hubCLIConfig
50 if err := yaml.NewDecoder(f).Decode(&cfg); err != nil {
51 return nil, fmt.Errorf("failed to parse hub config file: %w", err)
52 }
53
54 return cfg, nil
55}
56
57// gh cli config (https://cli.github.com)
58type ghCLIConfig map[string]struct {

Callers 1

findTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected