diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-18 16:57:17 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-07-18 16:57:17 -0400 |
| commit | 295f35e901f2088f54b66bd8bb0c0646d8e8c181 (patch) | |
| tree | 05391382c5d88716e1a578ecc9a87f20ebc8f016 /cmd | |
| parent | 09cd2f2f80920830cc3fd3636a6b9fc93b10f743 (diff) | |
Add flag to avoid crawling hidden files
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/index.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cmd/index.go b/cmd/index.go index f072599..2f18fe0 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -19,10 +19,19 @@ type IndexFlags struct { } func setupIndexFlags(args []string, fs *flag.FlagSet, flags *IndexFlags) { + flags.ParseLinks = true + flags.ParseMeta = true fs.BoolVar(&flags.IgnoreDateError, "ignoreBadDates", false, "ignore malformed dates while indexing") fs.BoolVar(&flags.IgnoreMetaError, "ignoreMetaError", false, "ignore errors while parsing general YAML header info") - fs.BoolVar(&flags.ParseMeta, "parseMeta", true, "parse YAML header values other title, authors, date, tags") - fs.BoolVar(&flags.ParseLinks, "parseLinks", true, "parse file contents for links") + fs.BoolFunc("ignoreMeta", "don't parse YAML header values other title, authors, date, tags", func(s string) error { + flags.ParseMeta = false + return nil + }) + fs.BoolFunc("ignoreLinks", "don't parse file contents for links", func(s string) error { + flags.ParseLinks = false + return nil + }) + fs.BoolVar(&flags.IgnoreHidden, "ignoreHidden", false, "ignore hidden files while crawling") fs.Usage = func() { f := fs.Output() @@ -84,7 +93,7 @@ func runIndex(gFlags GlobalFlags, iFlags IndexFlags, db *data.Query) byte { ) } - traversedFiles := idx.Traverse(gFlags.NumWorkers) + traversedFiles := idx.Traverse(gFlags.NumWorkers, iFlags.IgnoreHidden) fmt.Print("Crawled ", len(traversedFiles)) filteredFiles := idx.Filter(traversedFiles, gFlags.NumWorkers) |
