Genivia / ugrep-indexer

A monotonic indexer to speed up grepping by >10x (ugrep-indexer is now part of ugrep 6.0)
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
67 stars 1 forks source link

Parameter "-X" doesn't work at all #13

Closed marcin-github closed 5 months ago

marcin-github commented 5 months ago

Hi, I'm playing with ugrep (-indexer) and I noticed that option "-X" doesn't work. Option "--ignore-files" works as documented:

$ nice ugrep-indexer -9 -z --ignore-files=.gitignore

> index accuracy: 9 (3%~10% noise)
> decompress:     yes (zmax=1)
> ignore binary:  no
> ignore files:   ".gitignore"
> index hidden:   no

   2151816032 bytes scanned and indexed with 67% noise on average
        51599 files indexed in 5 directories
            1 new directories indexed
           15 new files indexed
           40 modified files indexed
            0 deleted files removed from indexes
          174 binary files indexed
            0 binary files ignored with --ignore-binary
            5 directories ignored with --ignore-files
            0 files ignored with --ignore-files
            0 symbolic links skipped
            0 devices skipped
       918435 bytes indexing storage increase at 17 bytes/file

Indexes are fresh and up to date

and with -X

$ nice ugrep-indexer -9 -z -X .gitignore

> index accuracy: 9 (3%~10% noise)
> decompress:     yes (zmax=1)
> ignore binary:  no
> ignore files:   ".gitignore"
> index hidden:   no

ugrep-indexer: error: cannot open directory .gitignore: Not a directory
ugrep-indexer: error: cannot create index file in .gitignore: Not a directory

            0 files indexed in 0 directories
            1 new directories indexed
            0 new files indexed
            0 modified files indexed
            0 deleted files removed from indexes
            0 binary files indexed
            0 binary files ignored with --ignore-binary
            0 directories ignored with --ignore-files
            0 files ignored with --ignore-files
            0 symbolic links skipped
            0 devices skipped
            2 warnings
            0 bytes indexing storage decrease

Indexes are fresh and up to date
genivia-inc commented 5 months ago

Option -X does not accept an argument, it only assumes the default .gitignore is used.

genivia-inc commented 5 months ago

An optional FILE argument can be specified with the --ignore-files long option using the = sign. The short -X option is the same as --ignore-files but does not accept a FILE argument. If we want to change -X to accept a FILE argument then -X must always accept a FILE argument (which I don't prefer). We could do a -X=FILE, but that is not a standard convention.

marcin-github commented 5 months ago

Thank you for explanation.

genivia-inc commented 5 months ago

Thanks for reporting, since questions like these help to improve the help pages. I've updated the help and man pages to make it more clear that -X does not take an argument.