Documentation
¶
Overview ¶
Package state is in charge of storing and reading application state.
Index ¶
Constants ¶
View Source
const ( // ViewHostList mode is active when we browse through a list of hostnames. ViewHostList view = iota // ViewGroupList mode is active when the app displays available host groups. ViewGroupList // ViewEditItem mode is active when we edit existing or add a new host. ViewEditItem // ViewMessage mode is active when there was an error when attempted to connect to a remote host. ViewMessage )
Variables ¶
This section is empty.
Functions ¶
func IsInitialized ¶ added in v1.4.0
func IsInitialized() bool
IsInitialized - checks if the application state is initialized.
Types ¶
type Once ¶ added in v1.4.0
type Once interface {
Do(func())
}
Once - this interface is used to avoid sync.Once restrictions in unit-tests.
type State ¶ added in v1.5.0
type State struct {
// Note that the app load ssh_config_file_path from SSHConfigPath,
// but persists it to disk using SetSSHConfigPath.
// This is done to distinguish between --set-ssh-config-path flag usage and
// and setting the path via command line -s or env variable.
AppHome string `yaml:"-"`
AppMode constant.AppMode `yaml:"-"`
Context context.Context `yaml:"-"`
CurrentView view `yaml:"-"`
Group string `yaml:"group,omitempty"`
Height int `yaml:"-"`
IsUserDefinedSSHConfigPath bool `yaml:"-"`
Logger loggerInterface `yaml:"-"`
LogLevel constant.LogLevel `yaml:"-"`
ScreenLayout constant.ScreenLayout `yaml:"screen_layout,omitempty"`
SetSSHConfigPath string `yaml:"ssh_config_path,omitempty"`
Selected int `yaml:"selected"`
SSHConfigEnabled bool `yaml:"enable_ssh_config"`
SSHConfigPath string `yaml:"-"`
Theme string `yaml:"theme,omitempty"`
Width int `yaml:"-"`
}
State stores application state.
func Initialize ¶ added in v1.5.0
func Initialize(ctx context.Context, cfg *config.Configuration, lg loggerInterface, ) (*State, error)
Initialize - creates application state.
func (*State) LogDetails ¶ added in v1.5.0
func (s *State) LogDetails()
func (*State) PrintConfig ¶ added in v1.5.0
func (s *State) PrintConfig()
PrintConfig outputs user-definable parameters in the console.
Click to show internal directories.
Click to hide internal directories.