ability to omit front end files like .css .js .html and so on
This commit is contained in:
+9
-1
@@ -58,6 +58,7 @@ Examples:
|
|||||||
protonDrive bool
|
protonDrive bool
|
||||||
drivePath string
|
drivePath string
|
||||||
verticalSlices bool
|
verticalSlices bool
|
||||||
|
skipFrontend bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
@@ -78,6 +79,7 @@ func init() {
|
|||||||
rootCmd.Flags().BoolVar(&protonDrive, "proton-drive", false, "upload output to Proton Drive after writing locally")
|
rootCmd.Flags().BoolVar(&protonDrive, "proton-drive", false, "upload output to Proton Drive after writing locally")
|
||||||
rootCmd.Flags().StringVar(&drivePath, "drive-path", "", "full remote path on Proton Drive (e.g. /my-files/md/report.md). Requires --proton-drive")
|
rootCmd.Flags().StringVar(&drivePath, "drive-path", "", "full remote path on Proton Drive (e.g. /my-files/md/report.md). Requires --proton-drive")
|
||||||
rootCmd.Flags().BoolVar(&verticalSlices, "vertical-slices", false, "split output into root file + one markdown per top-level directory")
|
rootCmd.Flags().BoolVar(&verticalSlices, "vertical-slices", false, "split output into root file + one markdown per top-level directory")
|
||||||
|
rootCmd.Flags().BoolVar(&skipFrontend, "skip-frontend", false, "omit frontend file types (.html, .css, .js, .ts, .vue, .svelte, etc.)")
|
||||||
|
|
||||||
rootCmd.MarkPersistentFlagRequired("output")
|
rootCmd.MarkPersistentFlagRequired("output")
|
||||||
}
|
}
|
||||||
@@ -95,6 +97,11 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
return fmt.Errorf("--vertical-slices cannot be used with --input-file")
|
return fmt.Errorf("--vertical-slices cannot be used with --input-file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
excludedExts := append(config.DefaultExts, extensions...)
|
||||||
|
if skipFrontend {
|
||||||
|
excludedExts = append(excludedExts, config.FrontendExts...)
|
||||||
|
}
|
||||||
|
|
||||||
cfg := &config.Config{
|
cfg := &config.Config{
|
||||||
OutputPath: outputPath,
|
OutputPath: outputPath,
|
||||||
AppendMode: appendMode,
|
AppendMode: appendMode,
|
||||||
@@ -102,10 +109,11 @@ func run(cmd *cobra.Command, args []string) error {
|
|||||||
MaxSize: maxSize,
|
MaxSize: maxSize,
|
||||||
MaxDepth: maxDepth,
|
MaxDepth: maxDepth,
|
||||||
Ignores: append(config.DefaultIgnores, ignorePatterns...),
|
Ignores: append(config.DefaultIgnores, ignorePatterns...),
|
||||||
Extensions: append(config.DefaultExts, extensions...),
|
Extensions: excludedExts,
|
||||||
ProtonDrive: protonDrive,
|
ProtonDrive: protonDrive,
|
||||||
DrivePath: drivePath,
|
DrivePath: drivePath,
|
||||||
VerticalSlices: verticalSlices,
|
VerticalSlices: verticalSlices,
|
||||||
|
SkipFrontend: skipFrontend,
|
||||||
}
|
}
|
||||||
|
|
||||||
if singleFile != "" {
|
if singleFile != "" {
|
||||||
|
|||||||
@@ -35,12 +35,20 @@ var DefaultExts = []string{
|
|||||||
".pdf", ".doc", ".docx", ".xls", ".xlsx",
|
".pdf", ".doc", ".docx", ".xls", ".xlsx",
|
||||||
".pem", ".key", ".cert",
|
".pem", ".key", ".cert",
|
||||||
".db", ".sqlite", ".sqlite3",
|
".db", ".sqlite", ".sqlite3",
|
||||||
".class", // Java compiled bytecode
|
".class",
|
||||||
".jar", // JAR archives
|
".jar",
|
||||||
".war",
|
".war",
|
||||||
".ear",
|
".ear",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var FrontendExts = []string{
|
||||||
|
".html", ".htm", ".gohtml", ".tmpl",
|
||||||
|
".css", ".scss", ".sass", ".less",
|
||||||
|
".js", ".jsx", ".mjs", ".cjs",
|
||||||
|
".ts", ".tsx",
|
||||||
|
".vue", ".svelte",
|
||||||
|
}
|
||||||
|
|
||||||
type stringSlice []string
|
type stringSlice []string
|
||||||
|
|
||||||
func (s *stringSlice) String() string {
|
func (s *stringSlice) String() string {
|
||||||
@@ -66,6 +74,7 @@ type Config struct {
|
|||||||
ProtonDrive bool
|
ProtonDrive bool
|
||||||
DrivePath string
|
DrivePath string
|
||||||
VerticalSlices bool
|
VerticalSlices bool
|
||||||
|
SkipFrontend bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func PrintUsage() {
|
func PrintUsage() {
|
||||||
@@ -90,6 +99,7 @@ func Parse() (*Config, error) {
|
|||||||
protonDrive bool
|
protonDrive bool
|
||||||
drivePath string
|
drivePath string
|
||||||
verticalSlices bool
|
verticalSlices bool
|
||||||
|
skipFrontend bool
|
||||||
)
|
)
|
||||||
|
|
||||||
flag.StringVar(&input, "i", "", "single file input (append mode only)")
|
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.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.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(&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.Usage = PrintUsage
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -129,6 +140,11 @@ func Parse() (*Config, error) {
|
|||||||
return nil, fmt.Errorf("--vertical-slices cannot be used with --input-file")
|
return nil, fmt.Errorf("--vertical-slices cannot be used with --input-file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
excludedExts := append(DefaultExts, exts...)
|
||||||
|
if skipFrontend {
|
||||||
|
excludedExts = append(excludedExts, FrontendExts...)
|
||||||
|
}
|
||||||
|
|
||||||
cfg := &Config{
|
cfg := &Config{
|
||||||
OutputPath: output,
|
OutputPath: output,
|
||||||
AppendMode: appendMd,
|
AppendMode: appendMd,
|
||||||
@@ -136,10 +152,11 @@ func Parse() (*Config, error) {
|
|||||||
MaxSize: maxSize,
|
MaxSize: maxSize,
|
||||||
MaxDepth: maxDepth,
|
MaxDepth: maxDepth,
|
||||||
Ignores: append(DefaultIgnores, ignores...),
|
Ignores: append(DefaultIgnores, ignores...),
|
||||||
Extensions: append(DefaultExts, exts...),
|
Extensions: excludedExts,
|
||||||
ProtonDrive: protonDrive,
|
ProtonDrive: protonDrive,
|
||||||
DrivePath: drivePath,
|
DrivePath: drivePath,
|
||||||
VerticalSlices: verticalSlices,
|
VerticalSlices: verticalSlices,
|
||||||
|
SkipFrontend: skipFrontend,
|
||||||
}
|
}
|
||||||
|
|
||||||
if input != "" {
|
if input != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user