package parser
import "github.com/gobuffalo/packr/v2/jam/parser"
Index ¶
- Variables
- func FromArgs(args []string, fn func(Boxes) error) error
- func IsProspect(path string, ignore ...string) (status bool)
- type Box
- type Boxes
- type File
- func NewFile(path string, r io.Reader) *File
- func (f File) Name() string
- func (f *File) String() string
- func (s *File) Write(p []byte) (int, error)
- type ParsedFile
- func ParseFile(gf packd.SimpleFile) (ParsedFile, error)
- func ParseFileMode(gf packd.SimpleFile, mode parser.Mode) (ParsedFile, error)
- type Parser
- func New(prospects ...*File) *Parser
- func NewFromRoots(roots []string, opts *RootsOptions) (*Parser, error)
- func (p *Parser) Run() (Boxes, error)
- type RootsOptions
- type Visitor
Variables ¶
var DefaultIgnoredFolders = []string{".", "_", "vendor", "node_modules", "_fixtures", "testdata"}
Functions ¶
func FromArgs ¶
FromArgs is useful when writing packr store-cmd binaries.
package main import ( "log" "os" "github.com/gobuffalo/packr/v2/jam/parser" "github.com/markbates/s3packr/s3packr" ) func main() { err := parser.FromArgs(os.Args[1:], func(boxes parser.Boxes) error { for _, box := range boxes { s3 := s3packr.New(box) if err := s3.Pack(box); err != nil { return err } } return nil }) if err != nil { log.Fatal(err) } }
func IsProspect ¶
Types ¶
type Box ¶
type Box struct { Name string // name of the box Path string // relative path of folder NewBox("./templates") AbsPath string // absolute path of Path Package string // the package name the box was found in PWD string // the PWD when the parser was run PackageDir string // the absolute path of the package where the box was found }
Box found while parsing a file
func NewBox ¶
NewBox stub from the name and the path provided
func (Box) String ¶
String - json returned
type Boxes ¶
type Boxes []*Box
type File ¶
File that is to be parsed
func NewFile ¶
NewFile takes the name of the file you want to write to and a reader to reader from
func (File) Name ¶
Name of the file "app.go"
func (*File) String ¶
String returns the contents of the reader
func (*File) Write ¶
type ParsedFile ¶
type ParsedFile struct { File packd.SimpleFile FileSet *token.FileSet Ast *ast.File Lines []string }
ParsedFile ...
func ParseFile ¶
func ParseFile(gf packd.SimpleFile) (ParsedFile, error)
ParseFile ...
func ParseFileMode ¶
func ParseFileMode(gf packd.SimpleFile, mode parser.Mode) (ParsedFile, error)
ParseFileMode ...
type Parser ¶
Parser to find boxes
func New ¶
New Parser from a list of File
func NewFromRoots ¶
func NewFromRoots(roots []string, opts *RootsOptions) (*Parser, error)
NewFromRoots scans the file roots provided and returns a new Parser containing the prospects
func (*Parser) Run ¶
Run the parser and run any boxes found
type RootsOptions ¶
func (RootsOptions) String ¶
func (r RootsOptions) String() string
type Visitor ¶
type Visitor struct { File packd.SimpleFile Package string // contains filtered or unexported fields }
func NewVisitor ¶
func (*Visitor) Run ¶
func (*Visitor) Visit ¶
Source Files ¶
args.go box.go file.go finder.go gogen.go parser.go prospect.go roots.go visitor.go
Directories ¶
Path | Synopsis |
---|---|
jam/parser/_fixtures | |
jam/parser/_fixtures/new_from_roots | |
jam/parser/_fixtures/new_from_roots/e | |
jam/parser/_fixtures/new_from_roots/_r | |
jam/parser/_fixtures/new_from_roots/w |
- Version
- v2.8.3 (latest)
- Published
- Nov 23, 2021
- Platform
- js/wasm
- Imports
- 20 packages
- Last checked
- 10 hours ago –
Tools for package owners.