--pick flag

This commit is contained in:
2026-09-15 11:42:41 +01:00
parent c72c0d0b79
commit b63f0ba927
4 changed files with 198 additions and 7 deletions
+12 -1
View File
@@ -11,7 +11,7 @@ import (
const (
DefaultMaxSize = 512 * 1024
DefaultMaxDepth = 20
Version = "0.1.0"
Version = "0.1.4"
)
var DefaultIgnores = []string{
@@ -65,6 +65,8 @@ type Config struct {
OmitTest bool
OmitMd bool
IncludeInstructions bool
PickPaths []string
SmallTree bool
}
func PrintUsage() {
@@ -94,6 +96,8 @@ func Parse() (*Config, error) {
omitTest bool
omitMd bool
includeInstructions bool
pickPaths stringSlice
smallTree bool
)
flag.StringVar(&input, "i", "", "single file input (append mode only)")
@@ -113,6 +117,8 @@ func Parse() (*Config, error) {
flag.BoolVar(&omitTest, "omit-test", false, "exclude test files and strip #[cfg(test)] blocks")
flag.BoolVar(&omitMd, "omit-md", false, "omit all .md files except README.md")
flag.BoolVar(&includeInstructions, "instructions", false, "include .dirmd instructions file if present in root")
flag.Var(&pickPaths, "pick", "repeatable: relative path to file to include as pick (requires --vertical-slices)")
flag.BoolVar(&smallTree, "small-tree", false, "use breadcrumb-only tree for picked files (default: full tree)")
flag.Usage = PrintUsage
flag.Parse()
@@ -137,6 +143,9 @@ func Parse() (*Config, error) {
if skipFrontend && frontendOnly {
return nil, fmt.Errorf("--skip-frontend and --frontend-only are mutually exclusive")
}
if len(pickPaths) > 0 && !verticalSlices {
return nil, fmt.Errorf("--pick requires --vertical-slices")
}
excludedExts := append(DefaultExts, exts...)
if skipFrontend {
@@ -159,6 +168,8 @@ func Parse() (*Config, error) {
OmitTest: omitTest,
OmitMd: omitMd,
IncludeInstructions: includeInstructions,
PickPaths: pickPaths,
SmallTree: smallTree,
}
if input != "" {