dotrill

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dotrill implements setting and getting key-value pairs in YAML files in ~/.rill.

Index

Constants

View Source
const (
	ConfigFilename      = "config.yaml"      // For user-facing config
	CredentialsFilename = "credentials.yaml" // For access tokens
	StateFilename       = "state.yaml"       // For CLI state
)

Constants for YAML files

View Source
const (
	DefaultOrgConfigKey       = "org"
	AnalyticsEnabledConfigKey = "analytics_enabled"
	AccessTokenCredentialsKey = "token"
	InstallIDStateKey         = "install_id"
)

Constants for YAML keys

Variables

This section is empty.

Functions

func AnalyticsInfo

func AnalyticsInfo() (installID string, enabled bool, err error)

AnalyticsInfo returns analytics info. It loads a persistent install ID from ~/.rill/state.yaml (setting one if not found). It gets analytics enabled/disabled info from ~/.rill/config.yaml (key "analytics_enabled"). It automatically migrates from the pre-v0.23 analytics config. See migrateOldAnalyticsConfig for details.

func Get

func Get(filename, key string) (string, error)

Get returns a single entry from ~/.rill/{filename}. It assumes filename identifies a YAML file.

func GetAccessToken

func GetAccessToken() (string, error)

GetToken loads the current auth token

func GetAll

func GetAll(filename string) (map[string]string, error)

GetAll loads all values from ~/.rill/{filename}. It assumes filename identifies a YAML file.

func GetDefaultOrg

func GetDefaultOrg() (string, error)

GetDefaultOrg loads the default org

func Set

func Set(filename, key, value string) error

Set sets a single value in ~/.rill/{filename}. It assumes filename identifies a YAML file.

func SetAccessToken

func SetAccessToken(token string) error

SetToken saves an auth token

func SetDefaultOrg

func SetDefaultOrg(orgName string) error

SetDefaultOrg saves the default org

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL