config

package
v0.0.0-...-c6a611f Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultPath = ".automux.hcl"

Variables

This section is empty.

Functions

func Exists

func Exists(path ...string) bool

Exists checks if an automux config exists in the current directory

Types

type Config

type Config struct {
	// Session id and title for the tmux session
	SessionId string `hcl:"session"`
	// SingleSession when set automux will not run if there is already a tmux session with the
	// provided {session}
	SingleSession bool   `hcl:"single_session,optional"`
	ConfigPath    string `hcl:"config,optional"`
	// Windows contains each of the tmux windo defs
	Windows []Window `hcl:"window,block"`
	// Sessions contains definitions for background sessions to open up
	Sessions []Session `hcl:"session,block"`

	// Cli args
	Debug bool
}

func Load

func Load(path string, debug bool) (*Config, error)

Load loads the config from the given file path

func (*Config) AsSession

func (c *Config) AsSession() Session

AsSession converts the Config instance to a Session one

type Session

type Session struct {
	// Directory to open the session in
	Directory string `hcl:"title,label"`

	// # Overrides:
	// Any config defined within the session block will be merged into any .automux.hcl
	// config found in the target directory with the session config taking presedence
	// over anything found there
	//
	// Session id and title for the tmux session
	SessionId string `hcl:"session,optional"`
	// SingleSession when set automux will not run if there is already a tmux session with the
	// provided {session}
	SingleSession *bool   `hcl:"single_session,optional"`
	ConfigPath    *string `hcl:"config,optional"`
	// Windows contains each of the tmux windo defs
	Windows []Window `hcl:"window,block"`

	Debug bool
}

type Split

type Split struct {
	// Vertical defines if the split is vertical or horizontal
	Vertical *bool `hcl:"vertical,optional"`
	// Cmd contains any command to be ran when opening the split
	Exec *string `hcl:"exec,optional"`
	// Size in % of the total screen realestate to take up
	Size *int `hcl:"size,optional"`
	// Focus sets the focus to this split after setup is done
	Focus *bool `hcl:"focus,optional"`
}

type Window

type Window struct {
	// Title of the window/tab
	Title string `hcl:"title,label"`
	// Cmd contains the command to be run on opening the window
	Exec *string `hcl:"exec,optional"`
	// Focus sets the focus to this window after setup is done
	Focus *bool `hcl:"focus,optional"`
	// Splits contains any extra splits to be opened in this window/tab
	Splits []Split `hcl:"split,block"`
}

Jump to

Keyboard shortcuts

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