func ExitIfErrors() {
	if exitStatus != 0 {
		Exit()
	}
}
ExitIfErrors will call Exit() if exitStatus is not 0
package internal
import (
	"flag"
	"fmt"
	"os"
	"strings"
	"sync"
	"time"
	"github.com/sirupsen/logrus"
)
var (
	waitTxConfirmationMaxDuration time.Duration
	ConsoleLog *logrus.Logger
	CqlCommands []*Command
)
func init() {
	ConsoleLog = logrus.New()
	ConsoleLog.SetFormatter(&logrus.TextFormatter{
		DisableTimestamp:       true,
		DisableLevelTruncation: true,
	})
}
type Command struct {
	Run func(cmd *Command, args []string)
	UsageLine string
	Short string
	Long string
	DebugFlag *flag.FlagSet
	CommonFlag *flag.FlagSet
	Flag *flag.FlagSet
}
func (c *Command) LongName() string {
	name := c.UsageLine
	if i := strings.Index(name, " ["); i >= 0 {
		name = name[:i]
	}
	if name == "cql" {
		return ""
	}
	return strings.TrimPrefix(name, "cql ")
}
func (c *Command) Name() string {
	name := c.LongName()
	if i := strings.LastIndex(name, " "); i >= 0 {
		name = name[i+1:]
	}
	return name
}
func (c *Command) Usage() {
	fmt.Fprintf(os.Stdout, "usage: %s\n", c.UsageLine)
	fmt.Fprintf(os.Stdout, "Run 'cql help %s' for details.\n", c.LongName())
	os.Exit(2)
}
func (c *Command) Runnable() bool {
	return c.Run != nil
}
var atExitFuncs []func()
func AtExit(f func()) {
	atExitFuncs = append(atExitFuncs, f)
}
func Exit() {
	for _, f := range atExitFuncs {
		f()
	}
	os.Exit(exitStatus)
}