quickgo

package
v2.4.9 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: GPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookQuickGoLoaded       = "quickgo.loaded"
	HookQuickGoServer       = "quickgo.server"
	HookQuickGoListProjects = "quickgo.funcs.listProjects"
	HookProjectLoaded       = "quickgo.project.loaded"
	HookProjectBeforeLoad   = "quickgo.project.beforeLoad"
	HookProjectExample      = "quickgo.project.example"
	HookProjectBeforeSave   = "quickgo.project.beforeSave"
	HookProjectAfterSave    = "quickgo.project.afterSave"
	HookProjectBeforeWrite  = "quickgo.project.beforeWrite"
	HookProjectAfterWrite   = "quickgo.project.afterWrite"
)
View Source
const (
	CMD_Blue          = "\033[34m"
	CMD_Cyan          = "\033[36m"
	CMD_Green         = "\033[32m"
	CMD_BRIGHT_Purple = "\033[35;1m"
	CMD_Purple        = "\033[35m"
	CMD_Red           = "\033[31m"
	CMD_Yellow        = "\033[33m"
	CMD_Bold          = "\033[1m"
	CMD_Underline     = "\033[4m"
	CMD_Reset         = "\033[0m"
)

Variables

This section is empty.

Functions

func BuildColorString added in v2.3.3

func BuildColorString(colors ...string) string

func ColoredLogWrapper

func ColoredLogWrapper(l logger.LogLevel, s string) string

func Craft

func Craft(color, s any) string

func GetProjectDirectoryPath added in v2.3.8

func GetProjectDirectoryPath(name string, absolute bool) string

func GetQuickGoPath added in v2.3.8

func GetQuickGoPath(p ...string) string

func Logfile added in v2.3.9

func Logfile(output io.Writer) io.Writer

Output the log file to the given writer. If the writer is nil, the log file will be written to the default location. This function may panic if the log file cannot be opened.

func PrintLogo()

Types

type App

type App struct {
	Config        *config.QuickGo `yaml:"config"`        // The configuration for QuickGo.
	ProjectConfig *config.Project `yaml:"projectConfig"` // The configuration for the project.
	Patterns      []string        `yaml:"patterns"`      // The patterns for the templates.
	AppFS         fs.FS           `yaml:"-"`             // The file system for the app, resides in the userprofile home directory.
	ProjectFS     fs.FS           `yaml:"-"`             // The file system for the project, resides in the project (working) directory.
	// contains filtered or unexported fields
}

func LoadApp

func LoadApp() (*App, error)

func (*App) CopyFileContent

func (a *App) CopyFileContent(proj *config.Project, file *os.File, f *quickfs.FSFile, raw bool) error

func (*App) ExecJS added in v2.4.4

func (a *App) ExecJS(targetDir string, scriptName string, args map[string]any) (err error)

func (*App) HttpHandler added in v2.3.5

func (a *App) HttpHandler() http.Handler

func (*App) ListJSFiles added in v2.4.4

func (a *App) ListJSFiles() ([]string, error)

func (*App) ListProjectObjects added in v2.3.5

func (a *App) ListProjectObjects() ([]*config.Project, error)

func (*App) ListProjects

func (a *App) ListProjects() ([]string, error)

func (*App) LoadCurrentProject added in v2.4.2

func (a *App) LoadCurrentProject(directory string) (err error)

Load the project configuration from the current working directory.

func (*App) Logger added in v2.3.9

func (a *App) Logger(level logger.LogLevel, output io.Writer) *logger.Logger

func (*App) NewProject added in v2.4.2

func (a *App) NewProject(conf SimpleProject) (proj *config.Project, err error)

func (*App) ReadFile

func (a *App) ReadFile(path string) ([]byte, error)

func (*App) ReadProjectConfig

func (a *App) ReadProjectConfig(name string) (proj *config.Project, closeFiles func(), err error)

func (*App) SaveJS added in v2.4.4

func (a *App) SaveJS(path string) error

func (*App) WriteExampleProjectConfig

func (a *App) WriteExampleProjectConfig(directory string) (err error)

Write an example configuration for the user.

func (*App) WriteFile

func (a *App) WriteFile(data []byte, path string) error

func (*App) WriteProject

func (a *App) WriteProject(proj *config.Project, directory string, raw bool) error

func (*App) WriteProjectConfig

func (a *App) WriteProjectConfig(proj *config.Project) error

type AppHook

type AppHook func(*App) error

quickgo.loaded

type AppListProjectsHook

type AppListProjectsHook func(*App, []*config.Project) ([]*config.Project, error)

quickgo.funcs.listProjects

type AppServeHook

type AppServeHook func(*App, http.ResponseWriter, *http.Request) (written bool, err error)

quickgo.server

type LogHandler added in v2.3.5

type LogHandler struct {
	Handler http.Handler
	Level   logger.LogLevel
	Where   string
}

func (*LogHandler) ServeHTTP added in v2.3.5

func (h *LogHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProjectHook

type ProjectHook func(*App, *config.Project) error

quickgo.project.loaded quickgo.project.example quickgo.project.beforeSave quickgo.project.afterSave

type ProjectTemplateContext

type ProjectTemplateContext struct {
	Project    *config.Project
	File       *quickfs.FSFile
	Dir        *quickfs.FSDirectory
	Parent     *quickfs.FSDirectory
	ObjectList any
	Content    string
}

type ProjectWithDirHook

type ProjectWithDirHook func(a *App, proj *config.Project, directory string) error

quickgo.project.beforeWrite quickgo.project.afterWrite quickgo.project.beforeLoad

type SimpleProject added in v2.4.2

type SimpleProject struct {
	Name       string                 `yaml:"name"`
	DelimLeft  string                 `yaml:"delimLeft"`
	DelimRight string                 `yaml:"delimRight"`
	Exclude    []string               `yaml:"exclude"`
	Context    map[string]interface{} `yaml:"context"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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