list

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package list builds a markdown inventory of PHP routes, files and classes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFiles

func ExpandFiles(paths []string) ([]string, error)

ExpandFiles resolves path arguments to a sorted list of PHP file paths. Path forms match Go's package patterns:

  • "." or "dir": .php/.phpt files in that directory only (non-recursive)
  • "./..." or "dir/...": that directory and all subdirectories
  • "file.php": that file

When paths is empty, "." is used.

func Markdown

func Markdown(rows []Row) string

Markdown renders rows as an indented, padded GitHub-flavoured markdown table.

Types

type PathGroup added in v0.4.0

type PathGroup struct {
	Dir     string
	Indexes []int
}

PathGroup is the paths of one folder: Dir holds the folder, "." when the paths sit in the run directory, and Indexes the positions of its paths in the input slice, so a caller can carry per-path data alongside without the group copying it.

func GroupByDir added in v0.4.0

func GroupByDir(paths []string) []PathGroup

GroupByDir buckets paths by the folder holding them, preserving the order the input established both between folders and inside one. Bucketing is explicit rather than relying on the sort, because sorted paths do not keep a folder contiguous: a/b.php, a/m/x.php and a/z.php interleave.

type Row

type Row struct {
	Route    string // e.g. "GET /users/{id}", "@startup", or empty
	Filename string // slash-separated path relative to the working directory
	Classes  string // comma-separated FQNs, or empty
}

Row is one markdown table row.

func File

func File(path string) ([]Row, error)

File returns inventory rows for one PHP source file.

func Paths

func Paths(paths []string) ([]Row, error)

Paths scans path arguments and returns inventory rows.

Jump to

Keyboard shortcuts

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