cmd

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CsvExt  = ".csv"
	TsvExt  = ".tsv"
	JsonExt = ".json"
	GfmExt  = ".md"
	OrgExt  = ".org"
)
View Source
const (
	TerminalPrompt           string = "csvq > "
	TerminalContinuousPrompt string = "     > "
)
View Source
const HistoryFile = ".csvq_history"
View Source
const UNDEF = -1

Variables

This section is empty.

Functions

func CreateFile added in v0.1.6

func CreateFile(filename string, s string) error

func EscapeString added in v0.8.0

func EscapeString(s string) string

func GetLocation

func GetLocation() *time.Location

func GetRand

func GetRand() *rand.Rand

func GetReader

func GetReader(r io.Reader, enc Encoding) io.Reader

func HumarizeNumber added in v0.6.1

func HumarizeNumber(s string) string

func IsReadableFromPipeOrRedirection added in v0.8.0

func IsReadableFromPipeOrRedirection() bool

func Now

func Now() time.Time

func SetCPU added in v0.6.2

func SetCPU(i int)

func SetColor added in v1.3.0

func SetColor(b bool)

func SetDatetimeFormat added in v0.2.7

func SetDatetimeFormat(s string)

func SetDelimiter

func SetDelimiter(s string) error

func SetEncoding

func SetEncoding(s string) error

func SetFormat

func SetFormat(s string) error

func SetJsonQuery added in v1.3.0

func SetJsonQuery(s string)

func SetLineBreak

func SetLineBreak(s string) error

func SetLocation added in v0.3.2

func SetLocation(s string) error

func SetNoHeader

func SetNoHeader(b bool)

func SetOut

func SetOut(s string) error

func SetPrettyPrint added in v1.3.0

func SetPrettyPrint(b bool)

func SetQuiet added in v0.7.7

func SetQuiet(b bool)

func SetRepository

func SetRepository(s string) error

func SetSource added in v0.1.6

func SetSource(s string) error

func SetStats added in v0.6.1

func SetStats(b bool)

func SetWaitTimeout added in v0.7.10

func SetWaitTimeout(f float64)

func SetWithoutHeader

func SetWithoutHeader(b bool)

func SetWithoutNull

func SetWithoutNull(b bool)

func SetWriteDelimiter

func SetWriteDelimiter(s string) error

func SetWriteEncoding

func SetWriteEncoding(s string) error

func ToStdout added in v0.1.6

func ToStdout(s string) error

func TryCreateFile added in v0.7.4

func TryCreateFile(filename string) error

func UnescapeString added in v0.1.5

func UnescapeString(s string) string

func UpdateFile added in v0.1.6

func UpdateFile(fp *os.File, s string) error

Types

type Encoding

type Encoding string
const (
	UTF8 Encoding = "UTF8"
	SJIS Encoding = "SJIS"
)

func ParseEncoding

func ParseEncoding(s string) (Encoding, error)

func (Encoding) String added in v0.1.6

func (e Encoding) String() string

type Flags

type Flags struct {
	// Global Options
	Delimiter      rune
	JsonQuery      string
	Encoding       Encoding
	LineBreak      LineBreak
	Location       string
	Repository     string
	Source         string
	DatetimeFormat string
	WaitTimeout    float64
	NoHeader       bool
	WithoutNull    bool

	// For Output
	WriteEncoding  Encoding
	OutFile        string
	Format         Format
	PrettyPrint    bool
	Color          bool
	WriteDelimiter rune
	WithoutHeader  bool

	// System Use
	Quiet bool
	CPU   int
	Stats bool

	// Fixed Value
	RetryInterval time.Duration

	// Use in tests
	Now string
}

func GetFlags

func GetFlags() *Flags

type Format

type Format int
const (
	TEXT Format = iota
	CSV
	TSV
	JSON
	JSONH
	JSONA
	GFM
	ORG
)

func (Format) String added in v1.1.0

func (f Format) String() string

type LineBreak

type LineBreak string
const (
	CR   LineBreak = "\r"
	LF   LineBreak = "\n"
	CRLF LineBreak = "\r\n"
)

func (LineBreak) String added in v0.8.0

func (lb LineBreak) String() string

func (LineBreak) Value

func (lb LineBreak) Value() string

type ReadLineTerminal added in v0.8.1

type ReadLineTerminal struct {
	// contains filtered or unexported fields
}

func (ReadLineTerminal) ReadLine added in v0.8.1

func (t ReadLineTerminal) ReadLine() (string, error)

func (ReadLineTerminal) SaveHistory added in v0.8.1

func (t ReadLineTerminal) SaveHistory(s string)

func (ReadLineTerminal) SetContinuousPrompt added in v0.8.1

func (t ReadLineTerminal) SetContinuousPrompt()

func (ReadLineTerminal) SetPrompt added in v0.8.1

func (t ReadLineTerminal) SetPrompt()

func (ReadLineTerminal) Teardown added in v0.8.1

func (t ReadLineTerminal) Teardown()

func (ReadLineTerminal) Write added in v0.8.1

func (t ReadLineTerminal) Write(s string) error

type VirtualTerminal added in v0.8.1

type VirtualTerminal interface {
	ReadLine() (string, error)
	Write(string) error
	SetPrompt()
	SetContinuousPrompt()
	SaveHistory(string)
	Teardown()
}
var Terminal VirtualTerminal

func NewTerminal added in v0.8.0

func NewTerminal() (VirtualTerminal, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL