Esempio n. 1
0
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
	})
}
Esempio n. 2
0
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
}
Esempio n. 3
0
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
}
Esempio n. 4
0
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
	})
}
Esempio n. 5
0
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
	})
}
Esempio n. 6
0
func (cmd Message) Run() gribble.Value {
	wm.PopupError("%s", cmd.Text)
	return nil
}