func buildAlertBox(alert AlertOptions) string {
  var message, style, duration, buttons, defaultButton string
  title := wrapInQuotes(alert.Title)
  if alert.Message != "" {
    message = "message " + wrapInQuotes(alert.Message)
  }
  if alert.Style != "" {
    style = "as " + alert.Style
  }
  if alert.Duration > 0 {
    duration = "giving up after " + strconv.Itoa(alert.Duration)
  }
  if alert.Buttons != "" {
    buttons = makeButtonList(alert.Buttons)
    if alert.DefaultButton != "" {
      defaultButton = "default button " + wrapInQuotes(alert.DefaultButton)
    }
  }
  return build("display alert", title, message, style, duration, buttons, defaultButton)
}
Parse the AlertBox options and build the command
package mack
import (
  "strconv"
)
func Alert(title string, options ...string) (Response, error) {
  return runWithButtons(buildAlert(title, options))
}
func buildAlert(title string, options []string) string {
  title = wrapInQuotes(title)
  var message, style, duration string
  if len(options) > 0 && options[0] != "" {
    message = "message " + wrapInQuotes(options[0])
  }
  if len(options) > 1 && options[1] != "" {
    style = "as " + options[1]
  }
  if len(options) > 2 && options[2] != "" {
    duration = "giving up after " + options[2]
  }
  return build("display alert", title, message, style, duration)
}
func AlertBox(alert AlertOptions) (Response, error) {
  return runWithButtons(buildAlertBox(alert))
}