Skip to content

Commit

Permalink
options
Browse files Browse the repository at this point in the history
  • Loading branch information
laktak committed Jun 8, 2024
1 parent c627594 commit 0c6c0b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ zfind 'name like "%.txt" and not archive' -0 | xargs -0 -L1 echo
zfind can also produce `--csv` that can be piped to other commands.


## Configuration

Set the environment variable `NO_COLOR` to disable color output.


## Installation

zfind is built for a number of platforms by GitHub actions.
Expand Down
6 changes: 4 additions & 2 deletions cmd/zfind/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ func printCsv(ch chan find.FileInfo) error {
func main() {
var cli struct {
FilterHelp bool `short:"H" help:"Show where-filter help."`
XWhere string `name:"where" short:"w" help:"(removed) this option has moved to the <where> argument"`
Long bool `short:"l" help:"Show long listing format."`
Csv bool `help:"Show listing as csv."`
ArchiveSeparator string `help:"Separator between the archive name and the file inside" default:"//"`
FollowSymlinks bool `short:"L" help:"Follow symbolic links."`
NoArchive bool `short:"n" help:"Disables archive support."`
Print0 bool `name:"print0" short:"0" help:"Use a a null character instead of the newline character, to be used with the -0 option of xargs."`
Version bool `short:"V" help:"Show version."`
XWhere string `name:"where" short:"w" help:"(removed) this option has moved to the <where> argument"`
Where string `arg:"" name:"where" optional:"" help:"The filter using sql-where syntax (see -H). Use '-' to skip when providing a path."`
Paths []string `arg:"" name:"path" optional:"" help:"Paths to search."`
}
Expand Down Expand Up @@ -116,7 +117,8 @@ func main() {
Chan: ch,
Err: errChan,
Filter: filter,
FollowSymlinks: cli.FollowSymlinks})
FollowSymlinks: cli.FollowSymlinks,
NoArchive: cli.NoArchive})
}
close(ch)
close(errChan)
Expand Down
3 changes: 2 additions & 1 deletion find/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func findIn(param WalkParams, fi FileInfo) {
var files []FileInfo
var err error = nil

if fi.IsDir() {
if fi.IsDir() || param.NoArchive {
return
}

Expand Down Expand Up @@ -279,6 +279,7 @@ type WalkParams struct {
Err chan string
Filter *filter.FilterExpression
FollowSymlinks bool
NoArchive bool
}

func (wp WalkParams) SendErr(err error) {
Expand Down

0 comments on commit 0c6c0b1

Please sign in to comment.