Commit Graph

477 Commits

Author SHA1 Message Date
Benjamin Fox b98f0783ff Enable link-time optimization in release builds
This gives a significant improvement to runtime performance, at the cost of somewhat worse compile times.
2018-10-14 18:47:25 +02:00
Josh Leeb-du Toit 8543ca645d Split internals.rs into module and multiple files
This PR splits `internals.rs` into the `internal` module with multiple
files, and moves `FdOptions` into `opts.rs`.

The main motivation behind this is to move logic for constructing
`FdOptions` out of the main function and more readable and easier to
understand in the `opts` module. The goal will eventually to be able
to write `FdOptions::from(matches)` and have the options constructed.
2018-10-12 19:14:19 +02:00
Josh Leeb-du Toit 984f04f142 Add print_error macros to replace functions
This patch replaces the `print_error` and `print_error_and_exit`
functions with equivalent macros.
2018-10-12 07:31:21 +02:00
Karim SENHAJI abe8aa55c0 clean-up first implementation of modification date filter 2018-10-10 19:52:37 +02:00
Karim SENHAJI 54c117d72f Add support for --changed-before and --changed-with for modification time based search 2018-10-10 19:52:37 +02:00
Josh Leeb-du Toit 8691ab4bed Minor changes to improve readability
This patch makes minor changes to make the code a little easier to
understand. For example, using the `?` operator in some fns that return
an `Option` type.
2018-10-04 09:44:09 +02:00
Josh Leeb-du Toit cb1cfa108b ErrorCode enum variants to be more descriptive 2018-10-03 16:06:18 +02:00
Josh Leeb-du Toit 8bdd8f8e8f Move exit code consts into enum
Previously, the constants defined in `src/exit_codes` weren't being
used, and the constants for exit codes were being redefined in the
`internals` module.

This PR removes the exit code consts and instead uses an enum defined in
`src/exit_codes`. This centralizes the definitions of exit codes making
them easier to modify and keep track of.
2018-10-03 16:06:18 +02:00
psinghal20 f9c4e8d399 refactor: loosen strict handling of missing --ignore-file 2018-10-03 13:11:51 +02:00
Josh Leeb-du Toit adc467b2b2 Add exec tests and cfg(test) compiler guards
Some tests throughout the codebase were just functions marked with the
`#[test]` macro. It is convention to have these test functions in a
`test` module with a compiler guard `cfg(test)`. This PR updates the
tests that aren't already setup like this to be in the `test` module.

Additionally, this PR also adds tests to the `exec` module to check the
remaining `Token` enum variations.
2018-10-03 13:04:22 +02:00
sharkdp 56b6389dac --exec: Do not exit on errors 2018-10-01 22:00:23 +02:00
sharkdp 046b0574dc Rename error => print_error_and_exit and introduce print_error 2018-10-01 22:00:23 +02:00
psinghal20 6407dc4eb4 chore: format code via rustfmt 2018-10-01 22:00:23 +02:00
psinghal20 2ebef2d46f feat: enable display of error messages 2018-10-01 22:00:23 +02:00
sharkdp 27caa33729 cargo fmt 2018-09-27 23:01:38 +02:00
sharkdp 53226f82eb Upgrade minimum reqiured version of Rust to 1.29
This upgrades the minimum required version of Rust to 1.29 in order to
fix #288.

See also:
- Rust compiler bug ticket: rust-lang/rust#50619
- Rust compiler PR with the fix: rust-lang/rust#50630

closes #288
2018-09-18 21:04:09 +02:00
sharkdp 8fb25f15c9 Just reference --max-depth in --maxdepth help 2018-09-13 22:33:18 +02:00
Mahmoud Al-Qudsi d375b5e1f5 Add `--maxdepth` as hidden alias for `--max-depth`
For muscle memory compatibility with `rg`. This variant will not show in
the help or in the program options, and is only checked if `--maxdepth`
is not specified.
2018-09-13 22:33:18 +02:00
sharkdp 2465cd1399 Update man page 2018-08-19 18:50:47 +02:00
sharkdp 1c7e647f61 Bump version 2018-08-19 18:50:41 +02:00
sharkdp 67e76b8b5b Update USAGE 2018-08-19 18:50:35 +02:00
sharkdp aa70c5a446 Add `--type empty`
Add a new `empty`/`e` type to search for empty files and/or directories.

To search for both empty files and directories, use one of the
following:

    fd --type empty
    fd -te

    fd --type empty --type file --type directory

To search for empty files, use

    fd --type empty --type file
    fd -te -tf

To search for empty directories, use

    fd --type empty --type directory
    fd -te -td

closes #273
2018-08-19 17:05:04 +02:00
sharkdp 50a2bab5cd Use short-circuiting for `--type` searches
Reverses the order of boolean checks for `--type` searches,
making them about 10% to 50% faster(!).
2018-08-19 16:27:23 +02:00
sharkdp 641976cf7a Remove duplicated `lstat` syscall
Removes a unnecessary `lstat` syscall by calling `.metadata()` only
once. This makes `--type executable` searches about 15% faster.
2018-08-19 16:23:06 +02:00
sharkdp 6fb5004b85 Enable ARM cross-compilation
closes #244
2018-08-19 15:30:59 +02:00
kpcyrd e4f61bc795 Remove unused windows dependencies 2018-08-18 16:40:08 +02:00
sharkdp c428f52209 Run cargo fmt 2018-08-03 21:20:48 +02:00
sharkdp 59c9901cde Update dependencies, fix #313 2018-08-03 21:20:48 +02:00
Alexandru Macovei 4dee8b7940 fix build for rust 1.20.0 2018-07-02 19:55:03 +02:00
Alexandru Macovei 9a45947234 simplify SizeFilter as enum with value instead of struct
Also move the touched cfg(test) code into cfg(test) module and trim test names
2018-07-02 19:55:03 +02:00
sharkdp c1ef68662c Update for new rustfmt 2018-05-14 21:00:00 +02:00
Josh Sleeper 9628d7fdcb chore(crate-updates): updated all crates to latest versions 2018-05-05 08:56:04 +02:00
David Peter cb47be6497
Fedora is now in the official repositories 2018-05-02 20:54:08 +02:00
sharkdp a3200204dc Simplifications to --size tests 2018-04-29 22:26:10 +02:00
Jonathan e2b2701965 Add helper method to create sized files, use meaningful names and add kibi and kilo tests. 2018-04-29 21:56:31 +02:00
Jonathan 409cf0c7a1 Remove use (which broke the build) 2018-04-29 21:56:31 +02:00
Jonathan f01685c63f Add tests for SizeFilter (--size) fixes sharkdp/fd#289 2018-04-29 21:56:31 +02:00
David Peter 060d14b5dc
Update README.md 2018-04-26 19:53:04 +02:00
Rainer Müller fe922688b3 README: Add install instructions for MacPorts 2018-04-26 19:51:04 +02:00
sharkdp 4172ed03f0 Do not include non-files when using --size 2018-04-25 23:08:05 +02:00
Steve Pentland 0bbc7f5219 Update regex and match, update comments 2018-04-25 08:14:12 +02:00
Steve Pentland ace3f512d3 Make compatible with min rust version 2018-04-25 08:14:12 +02:00
Steve Pentland 2f3b472dfd Changes from review 2018-04-25 08:14:12 +02:00
Steve Pentland 0207c1371e Initial impl of size constraints.
This adds find-style size constraints with + or - indicating greater
or less than, a numerical size, and a unit
2018-04-25 08:14:12 +02:00
David Peter fea85dbfb3 Re-enable nightly 2018-04-21 12:54:00 +02:00
sharkdp b5e5b132c8 Temporarily disable nightly, rustc-ap-rustc_errors is broken 2018-04-20 08:28:18 +02:00
sharkdp 6a9f16e159 Run latest version of rustfmt 2018-04-13 23:13:22 +02:00
sharkdp f02b3cba6a Fix typos 2018-04-13 23:13:22 +02:00
Chen Bin 666f90db87 Re-org fzf part. Doc on using fd with Emacs 2018-04-13 23:13:22 +02:00
Avindra Goolcharan 2a1ee0b17d README: openSUSE package available
add software.opensuse.org link and `zypper in fd`
2018-04-01 17:25:23 +02:00