app

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package app provides the Run function suitable for executing within func main. This package also defines the current version of Toki.

Index

Constants

View Source
const MainBundleFileGo = "bundle_gen.go"
View Source
const Version = "0.8.3"

Variables

View Source
var (
	ErrGenerateBundleFirst = errors.New("first generate a bundle using `toki generate`")
	ErrSourceErrors        = errors.New("source code contains errors")
	ErrNoCommand           = errors.New("no command")
	ErrUnknownCommand      = errors.New("unknown command")
	ErrAnalyzingSource     = errors.New("analyzing sources")
	ErrInvalidCLIArgs      = errors.New("invalid arguments")
	ErrMissingLocaleParam  = errors.New(
		"please provide a valid non-und BCP 47 locale for the default language of your " +
			"original code base using the 'l' parameter",
	)
	ErrBundleIncomplete = errors.New("bundle contains incomplete catalogs")
)

Functions

This section is empty.

Types

type Generate

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

Generate implements both the `toki generate` and the `toki lint` commands.

func (*Generate) Run

func (g *Generate) Run(
	osArgs, env []string, lintOnly bool, stderr io.Writer, now time.Time,
) (result Result)

type Result

type Result struct {
	Config       *config.ConfigGenerate
	Start        time.Time
	Scan         *codeparse.Scan
	NewTexts     []codeparse.Text
	RemovedTexts []codeparse.Text
	Err          error
}

func Run

func Run(
	osArgs, env []string, stderr, stdout io.Writer, now time.Time,
) (result Result, exitCode int)

func (Result) Print

func (r Result) Print()

type ResultJSON

type ResultJSON struct {
	Error          string                  `json:"error,omitempty"`
	StringCalls    int64                   `json:"string-calls"`
	WriteCalls     int64                   `json:"write-calls"`
	TIKs           int                     `json:"tiks"`
	TIKsUnique     int                     `json:"tiks-unique"`
	TIKsNew        int                     `json:"tiks-new"`
	FilesTraversed int                     `json:"files-traversed"`
	SourceErrors   []ResultJSONSourceError `json:"source-errors,omitempty"`
	TimeMS         int64                   `json:"time-ms"`
	Catalogs       []ResultJSONCatalog     `json:"catalogs"`
}

type ResultJSONCatalog

type ResultJSONCatalog struct {
	Locale       string  `json:"locale"`
	Completeness float64 `json:"completeness"`
}

type ResultJSONSourceError

type ResultJSONSourceError struct {
	Error string `json:"error"`
	File  string `json:"file"`
	Line  int    `json:"line"`
	Col   int    `json:"col"`
}

type WebEdit added in v0.8.0

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

WebEdit implements the command `toki webedit`.

func (*WebEdit) Run added in v0.8.0

func (g *WebEdit) Run(osArgs, env []string, stderr io.Writer) error

Jump to

Keyboard shortcuts

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