ability to omit front end files like .css .js .html and so on

This commit is contained in:
Bartal Laearsson
2026-08-07 23:26:43 +01:00
parent 6fbb9bf983
commit 9951a5947f
2 changed files with 29 additions and 4 deletions
+20 -3
View File
@@ -35,12 +35,20 @@ var DefaultExts = []string{
".pdf", ".doc", ".docx", ".xls", ".xlsx",
".pem", ".key", ".cert",
".db", ".sqlite", ".sqlite3",
".class", // Java compiled bytecode
".jar", // JAR archives
".class",
".jar",
".war",
".ear",
}
var FrontendExts = []string{
".html", ".htm", ".gohtml", ".tmpl",
".css", ".scss", ".sass", ".less",
".js", ".jsx", ".mjs", ".cjs",
".ts", ".tsx",
".vue", ".svelte",
}
type stringSlice []string
func (s *stringSlice) String() string {
@@ -66,6 +74,7 @@ type Config struct {
ProtonDrive bool
DrivePath string
VerticalSlices bool
SkipFrontend bool
}
func PrintUsage() {
@@ -90,6 +99,7 @@ func Parse() (*Config, error) {
protonDrive bool
drivePath string
verticalSlices bool
skipFrontend bool
)
flag.StringVar(&input, "i", "", "single file input (append mode only)")
@@ -104,6 +114,7 @@ func Parse() (*Config, error) {
flag.BoolVar(&protonDrive, "proton-drive", false, "upload output to Proton Drive after writing locally")
flag.StringVar(&drivePath, "drive-path", "", "full remote path on Proton Drive (requires --proton-drive)")
flag.BoolVar(&verticalSlices, "vertical-slices", false, "split output into root file + one markdown per top-level directory")
flag.BoolVar(&skipFrontend, "skip-frontend", false, "omit frontend file types (.html, .css, .js, .ts, .vue, .svelte, etc.)")
flag.Usage = PrintUsage
flag.Parse()
@@ -129,6 +140,11 @@ func Parse() (*Config, error) {
return nil, fmt.Errorf("--vertical-slices cannot be used with --input-file")
}
excludedExts := append(DefaultExts, exts...)
if skipFrontend {
excludedExts = append(excludedExts, FrontendExts...)
}
cfg := &Config{
OutputPath: output,
AppendMode: appendMd,
@@ -136,10 +152,11 @@ func Parse() (*Config, error) {
MaxSize: maxSize,
MaxDepth: maxDepth,
Ignores: append(DefaultIgnores, ignores...),
Extensions: append(DefaultExts, exts...),
Extensions: excludedExts,
ProtonDrive: protonDrive,
DrivePath: drivePath,
VerticalSlices: verticalSlices,
SkipFrontend: skipFrontend,
}
if input != "" {