func NewShell(cmd string) Shell {
	if !strings.HasSuffix(cmd, "\n") {
		cmd += "\n"
	}
	return Shell{Cmd: cmd}
}
NewShell creates a new Shell.
package main
import (
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"os/signal"
	"strconv"
	"strings"
	"time"
)
const CtrlPrefix = "#$"
var (
	Usage          = "usage: " + os.Args[0] + " <script>"
	ErrUnknownCtrl = errors.New("unknown control command")
	ErrNoArgs      = errors.New("no arguments given to command")
	ErrBadArg      = errors.New("invalid command argument")
)
func main() {
	if len(os.Args) < 2 || os.Args[1] == "-h" || os.Args[1] == "--help" {
		log.Fatal(Usage)
	}
	if exec.Command("asciinema", "-h").Run() != nil {
		log.Fatal("can't find asciinema executable")
	}
	s, err := NewScript(os.Args[1], os.Args[2:])
	if err != nil {
		log.Fatal("parsing script failed: ", err)
	}
	if err := s.Start(); err != nil {
		log.Fatal("couldn't start recording: ", err)
	}
	defer func() {
		if err := s.Stop(); err != nil {
			log.Fatal("couldn't stop recording: ", err)
		}
	}()
	s.Execute()
}
type Command interface {
	Run(*Script)
}
type Shell struct {
	Cmd string
}