Documentation
¶
Index ¶
- Constants
- func GetCacheHome() string
- func GetConfigDir() string
- func GetConfigFile() string
- func GetConfigHome() string
- func GetCurrentRepo() (string, error)
- func GetDataHome() string
- func GetRepositories() ([]string, error)
- func GetStateDir() string
- func GetStateFile() string
- func GetStateHome() string
- func GetUsername() (string, error)
- func RemoveUsername() error
- func SaveCurrentRepo(current string) error
- func SaveRepositories(repos []string) error
- func SaveState(state *State) error
- func SaveUsername(username string) error
- type Config
- type State
Constants ¶
View Source
const ( // AppName is the application name used in paths AppName = "osp" // ConfigFileName is the name of the config file ConfigFileName = "config.yaml" // StateFileName is the name of the state file StateFileName = "state.yaml" // DefaultDirMode is the default mode for directories DefaultDirMode = 0o700 // DefaultFileMode is the default mode for files DefaultFileMode = 0o600 )
Variables ¶
This section is empty.
Functions ¶
func GetConfigDir ¶ added in v0.1.11
func GetConfigDir() string
GetConfigDir returns the configuration directory path
func GetConfigFile ¶ added in v0.1.11
func GetConfigFile() string
GetConfigFile returns the path to the config file
func GetConfigHome ¶ added in v0.1.11
func GetConfigHome() string
GetConfigHome returns XDG_CONFIG_HOME
func GetCurrentRepo ¶ added in v0.1.11
GetCurrentRepo gets the current repository from state
func GetRepositories ¶ added in v0.1.11
GetRepositories gets the list of repositories from state
func GetStateDir ¶ added in v0.1.11
func GetStateDir() string
GetStateDir returns OSP state directory for storing program state
func GetStateFile ¶ added in v0.1.11
func GetStateFile() string
GetStateFile returns the path to the state file
func GetUsername ¶ added in v0.1.11
GetUsername gets the username from the state file
func RemoveUsername ¶ added in v0.1.11
func RemoveUsername() error
RemoveUsername removes the username from state
func SaveCurrentRepo ¶ added in v0.1.11
SaveCurrentRepo saves the current repository to state
func SaveRepositories ¶ added in v0.1.11
SaveRepositories saves the list of repositories to state
func SaveUsername ¶ added in v0.1.11
SaveUsername saves the username to state file
Types ¶
type State ¶ added in v0.1.11
type State struct {
// Username for authentication
Username string `yaml:"username,omitempty"`
// Current repository
Current string `yaml:"current,omitempty"`
// List of repositories
Repositories []string `yaml:"repositories,omitempty"`
}
State represents the application state
Click to show internal directories.
Click to hide internal directories.