fu

command module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2017 License: ISC Imports: 10 Imported by: 0

README

Find Unleashed

Fu is a more intuitive version of the Unix command find. It mainly searches by matching on filenames, but some meta-information like file mode is supported as well.

Index

Installation

If you have Go installed, run

go get -u github.com/kbrgl/fu

If you don't, download the latest release and put it somewhere on your $PATH.

Platform support

Unix-based systems (macOS, Linux distros, *BSDs, etc.) are supported. I'm guessing Windows will work as well, although I haven't tried it out on a Windows machine yet.

Usage

usage: fu [<flags>] <query> [<paths>...]

Flags:
  -h, --help       Show context-sensitive help (also try --help-long and
                   --help-man).
  -f, --fuzzy      Use fuzzy search
  -r, --regexp     Use regexp-based search
  -s, --suffix     Use suffix-based search
  -p, --prefix     Use prefix-based search
  -d, --dir        Show only directories
  -m, --perm=PERM  Filter by Unix permissions
  -c, --parallel   Walk directories in parallel, may result in substantial
                   speedups for directories with many files

Args:
  <query>    Search query
  [<paths>]  Paths to search

Path is current working directory by default, and the program uses exact filename matching by default.

Examples

The general usage pattern of fu is:

fu [<matchers>...] <query> [<paths>...]

Where matcher may be any of the matchers specified in the usage.

The only thing that's actually necessary is the query. By default,

fu <query>

Will recursively search for files with the exact same name as using the current directory as the root.

Find all dotfiles in the home folder
fu -p . ~
Find all Python scripts in current dir
fu -s .py
Find files in current dir whose names start and end with 'a'
fu -r "^a.*a\$"
Fuzzy matching
fu -f pkg

Will match any files that contain the letters p, k and g anywhere in the filename provided they occur in that exact order, so names like 'package', 'parking' and 'pkg2.txt' will be matched but names like 'p13ag5uk' where the letters do not appear in order won't.

Fuzzy search is the algorithm that Sublime Text and Atom use in their Command Palettes.

TODO

  • Write tests for matchers
  • Break up the main function into small, testable functions
  • Beautify TTY output somehow (colorization or something)
  • Find a way to estimate how much time a search will take, and print this estimate before performing the search. (I'm not sure if this is possible).
  • Remove -c flag and automatically switch between powerwalk and filepath Walk functions

PRs for these would be appreciated.

Contributing

Contributions are welcome. Just be sure to run go fmt and go vet on your code.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package shallowradix implements a radix tree of depth 1.
Package shallowradix implements a radix tree of depth 1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL