cmd

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OperationKeys matches the operation name (or the menu ID) with the keybinding.
	OperationKeys = map[Key]*KeyData{
		KeySwitch: {
			Title:   "Switch",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyTab, ' ', tcell.ModNone},
			Global:  true,
		},
		KeyClose: {
			Title:   "Close",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyEscape, ' ', tcell.ModNone},
			Global:  true,
		},
		KeyQuit: {
			Title:   "Quit",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyRune, 'Q', tcell.ModNone},
			Global:  true,
		},
		KeyMenu: {
			Title:   "Menu",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyRune, 'm', tcell.ModAlt},
		},
		KeySelect: {
			Title:   "Select",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyEnter, ' ', tcell.ModNone},
			Global:  true,
		},
		KeyCancel: {
			Title:   "Cancel",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyCtrlX, ' ', tcell.ModCtrl},
			Global:  true,
		},
		KeySuspend: {
			Title:   "Suspend",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyCtrlZ, ' ', tcell.ModCtrl},
			Global:  true,
		},
		KeyHelp: {
			Title:   "Help",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyRune, '?', tcell.ModNone},
			Global:  true,
		},
		KeyNavigateUp: {
			Title:   "Navigate Up",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyUp, ' ', tcell.ModNone},
		},
		KeyNavigateDown: {
			Title:   "Navigate Down",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyDown, ' ', tcell.ModNone},
		},
		KeyNavigateRight: {
			Title:   "Navigate Right",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyRight, ' ', tcell.ModNone},
		},
		KeyNavigateLeft: {
			Title:   "Navigate Left",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyLeft, ' ', tcell.ModNone},
		},
		KeyNavigateTop: {
			Title:   "Navigate Top",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyPgUp, ' ', tcell.ModNone},
		},
		KeyNavigateBottom: {
			Title:   "Navigate Bottom",
			Context: KeyContextApp,
			Kb:      Keybinding{tcell.KeyPgDn, ' ', tcell.ModNone},
		},
		KeyAdapterTogglePower: {
			Title:   "Power",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'o', tcell.ModNone},
		},
		KeyAdapterToggleDiscoverable: {
			Title:   "Discoverable",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'S', tcell.ModNone},
		},
		KeyAdapterTogglePairable: {
			Title:   "Pairable",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'P', tcell.ModNone},
		},
		KeyAdapterToggleScan: {
			Title:   "Scan",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 's', tcell.ModNone},
		},
		KeyAdapterChange: {
			Title:   "Change",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'a', tcell.ModNone},
		},
		KeyDeviceConnect: {
			Title:   "Connect",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'c', tcell.ModNone},
		},
		KeyDevicePair: {
			Title:   "Pair",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'p', tcell.ModNone},
		},
		KeyDeviceTrust: {
			Title:   "Trust",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 't', tcell.ModNone},
		},
		KeyDeviceBlock: {
			Title:   "Block",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'b', tcell.ModNone},
		},
		KeyDeviceSendFiles: {
			Title:   "Send",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'f', tcell.ModNone},
		},
		KeyDeviceNetwork: {
			Title:   "Network Options",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'n', tcell.ModNone},
		},
		KeyDeviceAudioProfiles: {
			Title:   "Audio Profiles",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'A', tcell.ModNone},
		},
		KeyDeviceInfo: {
			Title:   "Info",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'i', tcell.ModNone},
		},
		KeyDeviceRemove: {
			Title:   "Remove",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'd', tcell.ModNone},
		},
		KeyPlayerShow: {
			Title:   "Show Media Player",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'm', tcell.ModNone},
		},
		KeyPlayerHide: {
			Title:   "Hide Media Player",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, 'M', tcell.ModNone},
		},
		KeyPlayerTogglePlay: {
			Title:   "Play/Pause",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, ' ', tcell.ModNone},
		},
		KeyPlayerNext: {
			Title:   "Next",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, '>', tcell.ModNone},
		},
		KeyPlayerPrevious: {
			Title:   "Previous",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, '<', tcell.ModNone},
		},
		KeyPlayerSeekForward: {
			Title:   "Seek Forward",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyLeft, ' ', tcell.ModNone},
		},
		KeyPlayerSeekBackward: {
			Title:   "Seek Backward",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRight, ' ', tcell.ModNone},
		},
		KeyPlayerStop: {
			Title:   "Stop",
			Context: KeyContextDevice,
			Kb:      Keybinding{tcell.KeyRune, ']', tcell.ModNone},
		},
		KeyFilebrowserConfirmSelection: {
			Title:   "Confirm Selection",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyCtrlS, ' ', tcell.ModCtrl},
		},
		KeyFilebrowserDirForward: {
			Title:   "Go Forward",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyRight, ' ', tcell.ModNone},
		},
		KeyFilebrowserDirBack: {
			Title:   "Go Back",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyLeft, ' ', tcell.ModNone},
		},
		KeyFilebrowserSelect: {
			Title:   "Select",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyRune, ' ', tcell.ModNone},
		},
		KeyFilebrowserInvertSelection: {
			Title:   "Invert Selection",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyRune, 'a', tcell.ModNone},
		},
		KeyFilebrowserSelectAll: {
			Title:   "Select All",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyRune, 'A', tcell.ModNone},
		},
		KeyFilebrowserRefresh: {
			Title:   "Refresh",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyCtrlR, ' ', tcell.ModCtrl},
		},
		KeyFilebrowserToggleHidden: {
			Title:   "Hidden",
			Context: KeyContextFiles,
			Kb:      Keybinding{tcell.KeyRune, 'h', tcell.ModCtrl},
		},
		KeyProgressTransferResume: {
			Title:   "Resume Transfer",
			Context: KeyContextProgress,
			Kb:      Keybinding{tcell.KeyRune, 'g', tcell.ModNone},
		},
		KeyProgressTransferCancel: {
			Title:   "Cancel Transfer",
			Context: KeyContextProgress,
			Kb:      Keybinding{tcell.KeyRune, 'x', tcell.ModNone},
		},
		KeyProgressView: {
			Title:   "View Downloads",
			Context: KeyContextProgress,
			Kb:      Keybinding{tcell.KeyRune, 'v', tcell.ModNone},
		},
		KeyProgressTransferSuspend: {
			Title:   "Suspend Transfer",
			Context: KeyContextProgress,
			Kb:      Keybinding{tcell.KeyRune, 'z', tcell.ModNone},
		},
	}

	// Keys match the keybinding to the key type.
	Keys map[KeyContext]map[Keybinding]Key
)
View Source
var Version string

Version stores the version information.

Functions

func AddProperty added in v0.1.7

func AddProperty(property string, value interface{})

AddProperty adds a property and its value to the properties store.

func ConfigPath added in v0.0.6

func ConfigPath(configType string) (string, error)

ConfigPath returns the absolute path for the given configType.

func GetProperty added in v0.1.7

func GetProperty(property string) string

GetProperty returns the value for the given property.

func GetPropertyMap added in v0.1.8

func GetPropertyMap(property string) map[string]string

GetPropertyMap returns a map of values for the given property.

func Init added in v0.1.7

func Init(bluez *bluez.Bluez)

Init initializes the application.

func IsPropertyEnabled added in v0.1.7

func IsPropertyEnabled(property string) bool

IsPropertyEnabled returns if a property is enabled.

func KeyName added in v0.1.7

func KeyName(kb Keybinding) string

KeyName formats and returns the key's name.

func NavigationKey(pressed Key, event *tcell.EventKey) (*tcell.EventKey, bool)

NavigationKey checks whether the provided key is a navigation key.

func Parse added in v0.2.1

func Parse()

Parse parses the command-line parameters.

func Print added in v0.1.7

func Print(message string, status ...int)

Print displays a message.

func PrintError added in v0.1.7

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

PrintError prints an error to the screen.

func PrintWarn added in v0.1.7

func PrintWarn(message string)

PrintWarn prints a warning to the screen.

Types

type Config added in v0.1.7

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

Config describes the configuration for the app.

type ConfigDir added in v0.1.7

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

ConfigDir describes the path and properties of a configuration directory.

type Key added in v0.1.7

type Key string

Key describes the application keybinding type.

const (
	KeyMenu                        Key = "Menu"
	KeySelect                      Key = "Select"
	KeyCancel                      Key = "Cancel"
	KeySuspend                     Key = "Suspend"
	KeyQuit                        Key = "Quit"
	KeySwitch                      Key = "Switch"
	KeyClose                       Key = "Close"
	KeyHelp                        Key = "Help"
	KeyAdapterChange               Key = "AdapterChange"
	KeyAdapterTogglePower          Key = "AdapterTogglePower"
	KeyAdapterToggleDiscoverable   Key = "AdapterToggleDiscoverable"
	KeyAdapterTogglePairable       Key = "AdapterTogglePairable"
	KeyAdapterToggleScan           Key = "AdapterToggleScan"
	KeyDeviceSendFiles             Key = "DeviceSendFiles"
	KeyDeviceNetwork               Key = "DeviceNetwork"
	KeyDeviceConnect               Key = "DeviceConnect"
	KeyDevicePair                  Key = "DevicePair"
	KeyDeviceTrust                 Key = "DeviceTrust"
	KeyDeviceBlock                 Key = "DeviceBlock"
	KeyDeviceAudioProfiles         Key = "DeviceAudioProfiles"
	KeyDeviceInfo                  Key = "DeviceInfo"
	KeyDeviceRemove                Key = "DeviceRemove"
	KeyPlayerShow                  Key = "PlayerShow"
	KeyPlayerHide                  Key = "PlayerHide"
	KeyFilebrowserDirForward       Key = "FilebrowserDirForward"
	KeyFilebrowserDirBack          Key = "FilebrowserDirBack"
	KeyFilebrowserSelect           Key = "FilebrowserSelect"
	KeyFilebrowserInvertSelection  Key = "FilebrowserInvertSelection"
	KeyFilebrowserSelectAll        Key = "FilebrowserSelectAll"
	KeyFilebrowserRefresh          Key = "FilebrowserRefresh"
	KeyFilebrowserToggleHidden     Key = "FilebrowserToggleHidden"
	KeyFilebrowserConfirmSelection Key = "FilebrowserConfirmSelection"
	KeyProgressView                Key = "ProgressView"
	KeyProgressTransferSuspend     Key = "ProgressTransferSuspend"
	KeyProgressTransferResume      Key = "ProgressTransferResume"
	KeyProgressTransferCancel      Key = "ProgressTransferCancel"
	KeyPlayerTogglePlay            Key = "PlayerTogglePlay"
	KeyPlayerNext                  Key = "PlayerNext"
	KeyPlayerPrevious              Key = "PlayerPrevious"
	KeyPlayerSeekForward           Key = "PlayerSeekForward"
	KeyPlayerSeekBackward          Key = "PlayerSeekBackward"
	KeyPlayerStop                  Key = "PlayerStop"
	KeyNavigateUp                  Key = "NavigateUp"
	KeyNavigateDown                Key = "NavigateDown"
	KeyNavigateRight               Key = "NavigateRight"
	KeyNavigateLeft                Key = "NavigateLeft"
	KeyNavigateTop                 Key = "NavigateTop"
	KeyNavigateBottom              Key = "NavigateBottom"
)

The different application keybinding types.

func KeyOperation added in v0.1.7

func KeyOperation(event *tcell.EventKey, keyContexts ...KeyContext) Key

KeyOperation returns the operation name for the provided keyID and the keyboard event.

type KeyContext added in v0.1.7

type KeyContext string

KeyContext describes the context where the keybinding is supposed to be applied in.

const (
	KeyContextApp      KeyContext = "App"
	KeyContextDevice   KeyContext = "Device"
	KeyContextFiles    KeyContext = "Files"
	KeyContextProgress KeyContext = "Progress"
)

The different context types for keybindings.

type KeyData added in v0.1.7

type KeyData struct {
	Title   string
	Context KeyContext
	Kb      Keybinding
	Global  bool
}

KeyData stores the metadata for the key.

func OperationData added in v0.1.7

func OperationData(operation Key) *KeyData

OperationData returns the key data associated with the provided keyID and operation name.

type Keybinding added in v0.1.7

type Keybinding struct {
	Key  tcell.Key
	Rune rune
	Mod  tcell.ModMask
}

Keybinding stores the keybinding.

type Option added in v0.1.7

type Option struct {
	Name, Description, Value string
	IsBoolean                bool
}

Option describes a command-line option.

Jump to

Keyboard shortcuts

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