export

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LangGo   = "go"
	LangJSON = "json"
)

Variables

View Source
var (
	FileTypeGo      = FileType{Key: "go", Title: "Go", Icon: "file", Description: "Golang source code"}
	FileTypeJSON    = FileType{Key: "json", Title: "JSON", Icon: "file", Description: "JavaScript object notation"}
	FileTypeText    = FileType{Key: "text", Title: "Text", Icon: "file", Description: "Plain text"}
	FileTypeUnknown = FileType{Key: "unknown", Title: "unknown", Icon: "file", Description: "Unknown file type"}
)
View Source
var AllFileTypes = []FileType{FileTypeGo, FileTypeText}
View Source
var AllFormats = Formats{
	{Language: LangJSON, Flavor: util.AppKey},
	{Language: LangGo, Flavor: util.AppKey},
	{Language: LangGo, Flavor: "npn"},
	{Language: LangGo, Flavor: "fevo"},
	{Language: LangGo, Flavor: "stock"},
}

Functions

This section is empty.

Types

type File

type File struct {
	Pkg      util.Pkg
	Filename string
	Imports  []string
	Type     FileType
	// contains filtered or unexported fields
}

func NewGoFile

func NewGoFile(pkg util.Pkg, key string) *File

func NewJSONFile

func NewJSONFile(pkg util.Pkg, key string) *File

func (*File) AddComment

func (f *File) AddComment(content string)

func (*File) AddImport

func (f *File) AddImport(imp string)

func (*File) LB

func (f *File) LB()

func (*File) MarshalJSON

func (f *File) MarshalJSON() ([]byte, error)

func (*File) Path

func (f *File) Path() string

func (*File) Render

func (f *File) Render() []string

func (*File) RenderString

func (f *File) RenderString() string

func (*File) W

func (f *File) W(content string, indentDelta ...int)

func (*File) Wf

func (f *File) Wf(content string, args ...interface{})

type FileType

type FileType struct {
	Key         string `json:"key"`
	Title       string `json:"title,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Description string `json:"description,omitempty"`
}

func FileTypeFromString

func FileTypeFromString(s string) FileType

func (*FileType) MarshalJSON

func (t *FileType) MarshalJSON() ([]byte, error)

func (*FileType) String

func (t *FileType) String() string

func (*FileType) UnmarshalJSON

func (t *FileType) UnmarshalJSON(data []byte) error

type Format

type Format struct {
	Language string `json:"language"`
	Flavor   string `json:"flavor"`
}

func (Format) Get

func (f Format) Get(s string) string

func (Format) String

func (f Format) String() interface{}

type Formats

type Formats []*Format

func (Formats) Get

func (t Formats) Get(l string, f string) *Format

type Result

type Result struct {
	Key string `json:"key"`
	Out *File  `json:"out"`
}

type Results

type Results []*Result

func Model

func Model(m *model.Model, t *Format, logger *zap.SugaredLogger) (Results, error)

Jump to

Keyboard shortcuts

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