Repository: cli/cli
File: internal/config/config.go (Go)

Code before:
package config

import (
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"slices"

	"github.com/cli/cli/v2/internal/gh"
	"github.com/cli/cli/v2/internal/keyring"
	o "github.com/cli/cli/v2/pkg/option"
	ghauth "github.com/cli/go-gh/v2/pkg/auth"
	ghConfig "github.com/cli/go-gh/v2/pkg/config"
)

// It is important to note that some of these configuration setting keys are used outside of `cli/cli`
// such as `accessible_colors`, `browser`, and `http_unix_socket` used in `cli/go-gh`.
//
// These configuration settings are defined here to avoid `cli/cli` being changed unexpectedly.
const (
	accessibleColorsKey   = "accessible_colors"
	aliasesKey            = "aliases"
	browserKey            = "browser"
	colorLabelsKey        = "color_labels"
	editorKey             = "editor"
	gitProtocolKey        = "git_protocol"
	hostsKey              = "hosts"
	httpUnixSocketKey     = "http_unix_socket"
	oauthTokenKey         = "oauth_token"
	pagerKey              = "pager"
	promptKey             = "prompt"
	preferEditorPromptKey = "prefer_editor_prompt"
	userKey               = "user"
	usersKey              = "users"
	versionKey            = "version"
)

func NewConfig() (gh.Config, error) {
	c, err := ghConfig.Read(fallbackConfig())
	if err != nil {
		return nil, err
	}
	return &cfg{c}, nil
}

Review comment (suggestion):
Praise: Love this comment 🎉 

Question: Are there keys other than `accessible_colors`, `browser`, and `http_unix_socket` in `cli/go-gh` that exist outside of `cli/cli`?

Suggestion: Related to above question, if the answer is no, then how do you feel about updating it to be more direct (provided two options for you to consider 😁 ):

```suggestion
// Note: the `accessible_colors`, `browser`, and `http_unix_socket` keys are also used by `cli/go-gh`.
//
// These configuration settings are also defined here to avoid `cli/cli` being changed unexpectedly.
```

```suggestion
// Important: the `accessible_colors`, `browser`, and `http_unix_socket` keys are also used by `cli/go-gh`.
//
// These configuration settings are also defined here to avoid `cli/cli` being changed unexpectedly.
```


Code after:
package config

import (
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"slices"

	"github.com/cli/cli/v2/internal/gh"
	"github.com/cli/cli/v2/internal/keyring"
	o "github.com/cli/cli/v2/pkg/option"
	ghauth "github.com/cli/go-gh/v2/pkg/auth"
	ghConfig "github.com/cli/go-gh/v2/pkg/config"
)

// Important: some of the following configuration settings are used outside of `cli/cli`,
// they are defined here to avoid `cli/cli` being changed unexpectedly.
const (
	accessibleColorsKey   = "accessible_colors" // used by cli/go-gh to enable the use of customizable, accessible 4-bit colors.
	aliasesKey            = "aliases"
	browserKey            = "browser" // used by cli/go-gh to open URLs in web browsers
	colorLabelsKey        = "color_labels"
	editorKey             = "editor" // used by cli/go-gh to open interactive text editor
	gitProtocolKey        = "git_protocol"
	hostsKey              = "hosts" // used by cli/go-gh to locate authenticated host tokens
	httpUnixSocketKey     = "http_unix_socket"
	oauthTokenKey         = "oauth_token" // used by cli/go-gh to locate authenticated host tokens
	pagerKey              = "pager"
	promptKey             = "prompt"
	preferEditorPromptKey = "prefer_editor_prompt"
	userKey               = "user"
	usersKey              = "users"
	versionKey            = "version"
)

func NewConfig() (gh.Config, error) {
	c, err := ghConfig.Read(fallbackConfig())
	if err != nil {
		return nil, err
	}
	return &cfg{c}, nil
}

// Implements Config interface