Documentation ¶
Index ¶
- Variables
- func ExtractExamples(sources []string, outDir, languagesFile string, autoPull bool, ...) error
- func NewCLI() *cli.App
- func PullLanguagesYml(srcURL, destFile string) error
- func RunExamples(sources []string, expectedCount int, languagesFile string, autoPull bool, ...) error
- type Frob
- type GoFrob
- type InterpretedFrob
- type JavaFrob
- type LanguageDefinition
- type Languages
- type Runnable
- func (rn *Runnable) Args() []string
- func (rn *Runnable) Begin(lineno int, line string)
- func (rn *Runnable) ExpectedOutput() *regexp.Regexp
- func (rn *Runnable) Extract(i int, dir string) *runResult
- func (rn *Runnable) GoString() string
- func (rn *Runnable) Interruptable() (bool, time.Duration)
- func (rn *Runnable) IsValidOS() bool
- func (rn *Runnable) Run(i int) *runResult
- func (rn *Runnable) String() string
- type Runner
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultLanguagesYml = filepath.Join(getCacheDir(), "languages.yml") DefaultLanguagesYmlURL = "https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml" )
View Source
var ( VersionString = "" RevisionString = "" GeneratedString = "" CopyrightString = "" )
View Source
var ( DefaultFrobs = map[string]Frob{ "bash": NewSimpleInterpretedFrob("bash", "bash"), "go": &GoFrob{}, "java": &JavaFrob{}, "javascript": NewSimpleInterpretedFrob("js", "node"), "json": NewSimpleInterpretedFrob("json", "node"), "python": NewSimpleInterpretedFrob("py", "python"), "ruby": NewSimpleInterpretedFrob("rb", "ruby"), "shell": NewSimpleInterpretedFrob("bash", "bash"), "sh": NewSimpleInterpretedFrob("sh", "sh"), "zsh": NewSimpleInterpretedFrob("zsh", "zsh"), } )
Functions ¶
func ExtractExamples ¶
func PullLanguagesYml ¶
Types ¶
type Frob ¶
type Frob interface { Extension() string CanExecute(*Runnable) error TempFileName(*Runnable) string Environ(*Runnable) []string Commands(*Runnable) []*command }
type InterpretedFrob ¶
type InterpretedFrob struct {
// contains filtered or unexported fields
}
func (*InterpretedFrob) CanExecute ¶
func (e *InterpretedFrob) CanExecute(rn *Runnable) error
func (*InterpretedFrob) Commands ¶
func (e *InterpretedFrob) Commands(_ *Runnable) []*command
func (*InterpretedFrob) Environ ¶
func (e *InterpretedFrob) Environ(_ *Runnable) []string
func (*InterpretedFrob) Extension ¶
func (e *InterpretedFrob) Extension() string
func (*InterpretedFrob) TempFileName ¶
func (e *InterpretedFrob) TempFileName(rn *Runnable) string
type JavaFrob ¶
type JavaFrob struct{}
func (*JavaFrob) CanExecute ¶
func (*JavaFrob) TempFileName ¶
type LanguageDefinition ¶
type LanguageDefinition struct { Name string `json:"-"` Type string `json:"type,omitempty" yaml:"type"` Aliases []string `json:"aliases,omitempty" yaml:"aliases"` Interpreters []string `json:"interpreters,omitempty" yaml:"interpreters"` AceMode string `json:"ace_mode,omitempty" yaml:"ace_mode"` Group string `json:"group,omitempty" yaml:"group"` Canonical *LanguageDefinition `json:"-"` }
type Languages ¶
type Languages struct {
Map map[string]*LanguageDefinition
}
func LoadLanguages ¶
func (*Languages) Lookup ¶
func (l *Languages) Lookup(identifier string) *LanguageDefinition
type Runnable ¶
type Runnable struct { Frob Frob RawTags string Tags map[string]interface{} SourceFile string BlockStart string Lang string LineOffset int Lines []string // contains filtered or unexported fields }
func (*Runnable) ExpectedOutput ¶
type Runner ¶
type Runner struct { Sources []string Count int Frobs map[string]Frob Languages *Languages // contains filtered or unexported fields }
Runner is the top level of execution for running examples in sources
Source Files ¶
Click to show internal directories.
Click to hide internal directories.