cmd

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string

Version stores the version information.

Functions

func GetConfigDir added in v0.3.8

func GetConfigDir(dir string) (string, error)

GetConfigDir returns the full config path for the provided directory.

func GetOptionValue

func GetOptionValue(key string) string

GetOptionValue returns a value for an option from the configuration store.

func GetPath

func GetPath(ftype string, nocreate ...struct{}) (string, error)

GetPath returns the full config path for the provided file type.

func GetQueryParams

func GetQueryParams(queryType string) (string, string, error)

GetQueryParams returns the parameters for the search and play option types.

func Init

func Init()

Init parses the command-line parameters and initializes the application.

func IsOptionEnabled

func IsOptionEnabled(key string) bool

IsOptionEnabled returns if an option is enabled.

func PrintError

func PrintError(message string, err ...error)

PrintError prints an error to the screen.

func RegisterConfigHandler added in v0.3.8

func RegisterConfigHandler(h ConfigHandler, i ConfigType)

RegisterConfigHandler registers a configuration handler.

func RunAllGenerators added in v0.3.8

func RunAllGenerators(genMap map[string]interface{})

RunAllGenerators runs all the stored handler's generators.

func RunAllParsers added in v0.3.8

func RunAllParsers()

RunAllParsers runs all the stored handler's parsers.

func SaveSettings added in v0.3.3

func SaveSettings()

SaveSettings saves the application settings.

func SetOptionValue

func SetOptionValue(key string, value interface{})

SetOptionValue sets a value for an option in the configuration store.

Types

type Config

type Config struct {
	*koanf.Koanf
	// contains filtered or unexported fields
}

Config describes the configuration for the app.

type ConfigHandler added in v0.3.8

type ConfigHandler interface {
	Parse(k *koanf.Koanf, dir string) error
	Generate(k *koanf.Koanf) (interface{}, error)
}

ConfigHandler describes a configuration handler.

type ConfigSettings added in v0.3.8

type ConfigSettings struct {
	// contains filtered or unexported fields
}

ConfigSettings stores the configuration handlers.

type ConfigType added in v0.3.8

type ConfigType string

ConfigType describes the configuration type.

const (
	ConfigTheme       ConfigType = "theme"
	ConfigKeybindings ConfigType = "keybindings"
)

The different types of configuration handlers.

type Option

type Option struct {
	Name, Description string
	Value, Type       string
}

Option describes a command-line option.

type PlayHistorySettings added in v0.3.3

type PlayHistorySettings struct {
	Type       string `json:"type"`
	Title      string `json:"title"`
	Author     string `json:"author"`
	VideoID    string `json:"videoId"`
	PlaylistID string `json:"playlistId"`
	AuthorID   string `json:"authorId"`
}

PlayHistorySettings describes the format to store the play history.

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer describes the terminal printing configuration.

func (*Printer) Error

func (p *Printer) Error(message string)

Error displays an error and stops the application.

func (*Printer) Print

func (p *Printer) Print(message string, status ...int)

Print displays a loading spinner and a message.

func (*Printer) Stop

func (p *Printer) Stop(message ...string)

Stop stops the spinner.

type SettingsData added in v0.3.3

type SettingsData struct {
	Credentials []client.Credential `json:"credentials"`

	SearchHistory []string              `json:"searchHistory"`
	PlayHistory   []PlayHistorySettings `json:"playHistory"`

	PlayerStates []string `json:"playerStates"`
}

SettingsData describes the format to store the application settings.

var Settings SettingsData

Settings stores the application settings.

Jump to

Keyboard shortcuts

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