tpl

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var ConfigPath = filepath.Join(lo.Must1(os.UserHomeDir()), ".config", "go-cli")

nolint: gochecknoglobals

Functions

func GitURL

func GitURL(data []byte) string

func Package2url added in v1.1.17

func Package2url(str string) string

func ShortName added in v1.1.17

func ShortName(str string) string

func Walk added in v1.1.11

func Walk(dir Dir, path string, yield func(string, fs.DirEntry) error) error
Example

ExampleWalk is an example function.

package main

import (
	"embed"
	"fmt"
	"io/fs"

	"github.com/xuender/go-cli/tpl"
)

//go:embed files
var _files embed.FS

// ExampleWalk is an example function.
func main() {
	err := tpl.Walk(_files, ".", func(path string, entry fs.DirEntry) error {
		fmt.Println(path, entry.Name())

		return nil
	})

	fmt.Println(err)

}
Output:

files/a/aa aaa
files/b bb
files c
<nil>

func WriteTemplate added in v1.1.11

func WriteTemplate(files embed.FS)

Types

type Dir added in v1.1.11

type Dir interface {
	ReadDir(string) ([]fs.DirEntry, error)
	Open(string) (fs.File, error)
}

type DirEntry added in v1.1.11

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

func NewDirEntry added in v1.1.11

func NewDirEntry(path string) *DirEntry

func (*DirEntry) Open added in v1.1.11

func (p *DirEntry) Open(path string) (fs.File, error)

func (*DirEntry) ReadDir added in v1.1.11

func (p *DirEntry) ReadDir(path string) ([]fs.DirEntry, error)

func (*DirEntry) String added in v1.1.11

func (p *DirEntry) String() string

type Env

type Env struct {
	Year      string
	User      string
	Package   string
	Name      string
	Path      string
	Test      string
	License   string
	BuildTime string
	Version   string
}

func NewEnv added in v1.1.11

func NewEnv() *Env

func NewEnvByDir

func NewEnvByDir(arg string) *Env

func NewEnvByFile

func NewEnvByFile(arg, ext string) *Env

func NewEnvByGo

func NewEnvByGo(arg string) *Env

func (*Env) Bytes

func (p *Env) Bytes(files fs.FS, path string) []byte

Jump to

Keyboard shortcuts

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