Compare commits

...

1 Commits

Author SHA1 Message Date
spike 45da58766d option to start/switch silently
- makes switching from within tmux seamless
2 years ago

@ -27,8 +27,9 @@ type Window struct {
}
type Config struct {
SendKeysTimeout int `yaml:"sendkeys_timeout"`
Session string `yaml:"session"`
SendKeysTimeout int `yaml:"sendkeys_timeout"`
Silent bool `yaml:"silent"`
Env map[string]string `yaml:"env"`
Root string `yaml:"root"`
BeforeStart []string `yaml:"before_start"`

@ -9,6 +9,7 @@ import (
func TestParseConfig(t *testing.T) {
yaml := `
session: ${session}
silent: false
sendkeys_timeout: 200
windows:
- layout: tiled
@ -29,6 +30,7 @@ windows:
expected := Config{
Session: "test",
Silent: false,
SendKeysTimeout: 200,
Env: make(map[string]string),
Windows: []Window{

@ -102,17 +102,20 @@ func main() {
switch options.Command {
case CommandStart:
if len(options.Windows) == 0 {
fmt.Println("Starting a new session...")
} else {
fmt.Println("Starting new windows...")
}
config, err := GetConfig(configPath, options.Settings)
if err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
if !config.Silent {
if len(options.Windows) == 0 {
fmt.Println("Starting a new session...")
} else {
fmt.Println("Starting new windows...")
}
}
err = smug.Start(config, options, context)
if err != nil {
fmt.Println("Oops, an error occurred! Rolling back...")

Loading…
Cancel
Save