func (cmd AddWorkspace) Run() gribble.Value { return syncRun(func() gribble.Value { if err := wm.AddWorkspace(cmd.Name); err != nil { wm.PopupError("Could not add workspace '%s': %s", cmd.Name, err) return "" } return cmd.Name }) }
func (cmd WingoHelp) Run() gribble.Value { if len(strings.TrimSpace(cmd.CommandName)) == 0 { return nil } usage := Env.UsageTypes(cmd.CommandName) help := Env.Help(cmd.CommandName) wm.PopupError("%s\n%s\n%s", usage, strings.Repeat("-", len(usage)), help) return nil }
func (cmd WingoExec) Run() gribble.Value { Env.Verbose = true _, err := Env.RunMany(cmd.Commands) Env.Verbose = false if len(cmd.Commands) > 0 && err != nil { wm.PopupError("%s", err) } return nil }
func (cmd RenameWorkspace) Run() gribble.Value { return syncRun(func() gribble.Value { withWorkspace(cmd.Workspace, func(wrk *workspace.Workspace) { oldName := wrk.String() if err := wm.RenameWorkspace(wrk, cmd.NewName); err != nil { wm.PopupError("Could not rename workspace '%s': %s", wrk, err) return } wm.FYI("Workspace %s renamed to %s.", oldName, cmd.NewName) }) return nil }) }
func (cmd RemoveWorkspace) Run() gribble.Value { return syncRun(func() gribble.Value { withWorkspace(cmd.Workspace, func(wrk *workspace.Workspace) { if err := wm.RemoveWorkspace(wrk); err != nil { wm.PopupError("Could not remove workspace '%s': %s", wrk, err) return } wm.FYI("Workspace %s removed.", wrk) wm.FocusFallback() }) return nil }) }
func (cmd Message) Run() gribble.Value { wm.PopupError("%s", cmd.Text) return nil }