config

package
v1.0.4-beta Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name string

	ID          string `mapstructure:"application_id"`
	AdminAPIKey string `mapstructure:"admin_api_key"`

	Default bool `mapstructure:"default"`
}

func (*Application) Add

func (a *Application) Add() error

Add add an application to the configuration

func (*Application) GetAdminAPIKey

func (a *Application) GetAdminAPIKey() (string, error)

func (*Application) GetFieldName

func (a *Application) GetFieldName(field string) string

func (Application) GetID

func (a Application) GetID() (string, error)

func (*Application) LoadDefault

func (a *Application) LoadDefault()

func (*Application) Remove

func (a *Application) Remove() error

Remove remove an application from the configuration

func (*Application) SetDefault

func (a *Application) SetDefault() error

SetDefault set the default application

type Config

type Config struct {
	ApplicationName string

	Application Application

	File string
}

Config handles all overall configuration for the CLI

func (*Config) AppExists

func (c *Config) AppExists(appName string) bool

ApplicationExists check if a given application exists

func (*Config) ApplicationNames

func (c *Config) ApplicationNames() []string

ApplicationNames returns the list of name of the configured applications

func (*Config) ConfiguredApplications

func (c *Config) ConfiguredApplications() []*Application

ConfiguredApplications return the applications in the configuration file

func (*Config) GetConfigFolder

func (c *Config) GetConfigFolder(xdgPath string) string

GetConfigFolder retrieves the folder where the configuration file is stored It searches for the xdg environment path first and will secondarily place it in the home directory

func (*Config) InitConfig

func (c *Config) InitConfig()

InitConfig reads in profiles file and ENV variables if set.

Jump to

Keyboard shortcuts

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