Documentation
¶
Index ¶
- Variables
- func BuildBrevHome(fs afero.Fs, userHome string) error
- func CatFile(filePath string) (string, error)
- func DeleteFile(fs afero.Fs, filepath string) error
- func GetActiveOrgsPath(home string) string
- func GetBrevCloudflaredBinaryPath(home string) string
- func GetBrevHome(userHome string) string
- func GetBrevSSHConfigPath(home string) string
- func GetNewBackupSSHConfigFileName() string
- func GetNewBackupSSHConfigFilePath(home string) string
- func GetOnboardingStepPath(home string) string
- func GetPersonalSettingsPath(home string) string
- func GetSSHPrivateKeyFileName() string
- func GetSSHPrivateKeyPath(home string) string
- func GetUserSSHConfigPath(home string) (string, error)
- func OverwriteJSON(fs afero.Fs, filepath string, v interface{}) error
- func ReadJSON(fs afero.Fs, unsafeFilePathString string, v interface{}) error
- func ReadString(fs afero.Fs, unsafeFilePathString string) (string, error)
- func UserCachePath(brevHome string) string
- func WriteDefaultUserCache(cache *UserCache)
- func WritePersonalSettings(fs afero.Fs, home string, settings *PersonalSettings) error
- func WriteSSHPrivateKey(fs afero.Fs, data string, home string) error
- func WriteUserCache(fs afero.Fs, path string, cache *UserCache) error
- type PersonalSettings
- type UserCache
Constants ¶
This section is empty.
Variables ¶
View Source
var AppFs = afero.NewOsFs()
Functions ¶
func DeleteFile ¶
Delete a single file altogether.
func GetActiveOrgsPath ¶
func GetBrevCloudflaredBinaryPath ¶ added in v0.6.295
func GetBrevHome ¶ added in v0.6.0
func GetBrevSSHConfigPath ¶ added in v0.6.0
func GetNewBackupSSHConfigFileName ¶ added in v0.2.0
func GetNewBackupSSHConfigFileName() string
func GetNewBackupSSHConfigFilePath ¶ added in v0.2.0
func GetOnboardingStepPath ¶ added in v0.6.91
func GetPersonalSettingsPath ¶ added in v0.6.311
func GetSSHPrivateKeyFileName ¶
func GetSSHPrivateKeyFileName() string
func GetSSHPrivateKeyPath ¶ added in v0.6.0
func GetUserSSHConfigPath ¶ added in v0.2.0
func OverwriteJSON ¶
OverwriteJSON data in the target file with data from the given struct
Usage (unstructured):
OverwriteJSON("tmp/a/b/c.json", map[string]string{
"hi": "there",
})
Usage (struct):
var foo myStruct
OverwriteJSON("tmp/a/b/c.json", foo)
func ReadJSON ¶
ReadJSON reads data from a file into the given struct
Usage:
var foo myStruct
files.ReadJSON("tmp/a.json", &foo)
func UserCachePath ¶ added in v0.6.320
UserCachePath returns the path to the user cache file within the given brev home directory (e.g. ~/.brev).
func WriteDefaultUserCache ¶ added in v0.6.320
func WriteDefaultUserCache(cache *UserCache)
WriteDefaultUserCache writes to the default OS filesystem and home directory.
func WritePersonalSettings ¶ added in v0.6.311
func WritePersonalSettings(fs afero.Fs, home string, settings *PersonalSettings) error
Types ¶
type PersonalSettings ¶ added in v0.6.311
type PersonalSettings struct {
DefaultEditor string `json:"default_editor"`
AnalyticsEnabled *bool `json:"analytics_enabled,omitempty"` // nil = never asked, true = opted in, false = opted out
AnalyticsID string `json:"analytics_id,omitempty"` // stable anonymous ID for analytics
}
func ReadPersonalSettings ¶ added in v0.6.311
func ReadPersonalSettings(fs afero.Fs, home string) (*PersonalSettings, error)
type UserCache ¶ added in v0.6.320
type UserCache struct {
Email string `json:"email,omitempty"`
LinuxUser string `json:"linux_user,omitempty"`
}
UserCache holds cached user preferences persisted to ~/.brev/user_cache.json.
func ReadDefaultUserCache ¶ added in v0.6.320
func ReadDefaultUserCache() *UserCache
ReadDefaultUserCache reads the user cache from the default OS filesystem and home directory. Returns an empty cache on any error.
Click to show internal directories.
Click to hide internal directories.