Documentation
¶
Index ¶
- Variables
- func AuthFlow(notice string) (string, string, error)
- func AuthFlowComplete()
- func ConfigDir() string
- func ConfigFile() string
- func IsGitHubApp(id string) bool
- func StubBackupConfig() func()
- func StubConfig(content string) func()
- func StubWriteConfig(w io.Writer) func()
- type Config
- type ConfigMap
- type HostConfig
- type NotFoundError
Constants ¶
This section is empty.
Variables ¶
View Source
var BackupConfigFile = func(fn string) error { return os.Rename(fn, fn+".bak") }
View Source
var ReadConfigFile = func(fn string) ([]byte, error) { f, err := os.Open(fn) if err != nil { return nil, err } defer f.Close() data, err := ioutil.ReadAll(f) if err != nil { return nil, err } return data, nil }
View Source
var WriteConfigFile = func(fn string, data []byte) error { cfgFile, err := os.OpenFile(ConfigFile(), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return err } defer cfgFile.Close() n, err := cfgFile.Write(data) if err == nil && n < len(data) { err = io.ErrShortWrite } return err }
Functions ¶
func AuthFlowComplete ¶ added in v0.8.0
func AuthFlowComplete()
func ConfigFile ¶
func ConfigFile() string
func IsGitHubApp ¶ added in v0.8.0
IsGitHubApp reports whether an OAuth app is "GitHub CLI" or "GitHub CLI (dev)"
func StubBackupConfig ¶
func StubBackupConfig() func()
func StubConfig ¶
func StubConfig(content string) func()
func StubWriteConfig ¶
Types ¶
type Config ¶
type Config interface {
Hosts() ([]*HostConfig, error)
Get(string, string) (string, error)
Set(string, string, string) error
Write() error
}
This interface describes interacting with some persistent configuration for gh.
func ParseConfig ¶
func ParseDefaultConfig ¶
func ParseOrSetupConfigFile ¶
type ConfigMap ¶
type ConfigMap struct {
Root *yaml.Node
}
This type implements a low-level get/set config that is backed by an in-memory tree of Yaml nodes. It allows us to interact with a yaml-based config programmatically, preserving any comments that were present when the yaml waas parsed.
func (*ConfigMap) SetStringValue ¶
type HostConfig ¶
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.