Commit Graph

63 Commits

Author SHA1 Message Date
Thayne McCombs d44badc190 Implement option for printing custom formats 2024-05-07 22:52:49 -06:00
Thayne McCombs d441516c9d Use nu-ansi-term instead of ansi-term
Because ansi-term is no longer maintained.

Relates-To: #1188
2022-12-01 00:07:30 -07:00
Tavian Barnes 17d849df6c Compute colors in parallel 2022-10-31 22:23:30 +01:00
Tavian Barnes 7917c00887 dir_entry: Implement lscolors::Colorable 2022-10-31 22:23:30 +01:00
Tavian Barnes 4ffc34956f Make --strip-cwd-prefix apply to -x/-X
Fixes #898.
2022-10-03 21:35:39 +02:00
Jonathan Goren 47e30d3d4a add actual path separator value to config 2022-03-16 18:13:05 +02:00
Jonathan Goren 3dc61b5f28 rename module entry -> dir_entry 2021-12-11 15:43:52 +02:00
Jonathan Goren a26bd3232c append trailing slash to folders
update changelog
2021-12-11 15:43:23 +02:00
Jonathan Goren 813a802b2c send DirEntries to output instead of just path 2021-12-11 15:42:07 +02:00
Tavian Barnes 97a8825b00 output: Remove wants_to_quit handling from print_entry()
Since we only check it once per path now, we might as well just check it
before printing anything.
2021-12-05 12:06:49 -05:00
Thayne McCombs e990a13405 squash! Add buffering to stdout when it's not a terminal
Co-authored-by: sourlemon207 <jw1756@protonmail.com>
2021-11-26 21:23:47 +01:00
Thayne McCombs feac240eb5 Add buffering to stdout when it's not a terminal
This is based on the work of #736 by @sourlemon207.

I've added the suggestion I recommended on that PR.
2021-11-26 21:23:47 +01:00
David Peter 92bd7850d0 Merge remote-tracking branch 'origin/master' into no-strip/760 2021-11-26 18:19:28 +01:00
David Peter 4d7e34ad59 Rename option to strip_cwd_prefix, rename CLI option 2021-11-26 17:46:04 +01:00
Tavian Barnes 2b1bf471b1 Add an exit() method to ExitCode 2021-11-15 07:53:57 +01:00
Tavian Barnes 66e3ccc5e1 Don't color each path component separately
It can be expensive to color each path component separately, requiring a
stat() call on each component.  For deep hierarchies this can result in
quadratic overhead.  Instead, just color the path up to the basename as
a directory.

Fixes #720.
2021-11-14 17:42:16 +01:00
Jonah Caplan 2e115df9e7 simplify check in prent_entry 2021-10-15 23:57:03 -04:00
Jonah Caplan 6b92c5db90 add -N/--no-strip option to show "./" prefix on relative paths 2021-10-15 23:56:36 -04:00
Niklas Mohrin 02e9850112 Refactor: Rename `Options` to `Config` 2021-10-12 18:49:07 +02:00
David Peter b507449146 Handle IO errors based on type, closes #737 2021-08-08 13:10:16 +02:00
David Peter a7a4499d1d Fix unneeded references 2021-07-27 09:05:23 +02:00
David Peter 2a2126c40a Fix clippy warnings 2021-07-27 09:05:23 +02:00
johnwdjiang b8089f8d58 hide private func 2021-02-13 21:55:38 +01:00
xanonid 441a235a0f Simplify code a bit (suggestions by clippy) 2020-12-06 11:52:10 +01:00
Alexandru Macovei 4f4330167a Fix some clippy lints, and format 2020-05-01 14:08:53 +02:00
sharkdp 6c9e743d43 Print path as raw bytes, allowing invalid UTF-8 filenames to be passed to other processes 2020-04-04 18:46:08 +02:00
sharkdp e44f2f8540 Rewrite replace_path_separator function 2020-04-03 23:01:57 +02:00
sharkdp 2ea77e7cdc Add TODOs, move function 2020-04-03 22:51:41 +02:00
sharkdp 556c40e1f4 Move strip_current_dir 2020-04-03 22:36:32 +02:00
sharkdp 65096a653e Move FdOptions to Options 2020-04-03 22:36:32 +02:00
sharkdp 4274075f6f Remove outdated license headers (not strictly required by Apache-2.0) 2020-04-03 10:19:13 +02:00
sharkdp f14b854bc1 Use existing Cow pointer 2019-09-15 10:57:27 +02:00
Nathan Moreau e3af9b0307 Factor into a helper function; adapt to print_entry_uncolorized. 2019-09-15 10:57:27 +02:00
Nathan Moreau 29bf9d731d Handle any string replacement. 2019-09-15 10:57:27 +02:00
Nathan Moreau 24e108e1ad Add path-separator option.
Example usage: `fd.exe --path-separator /` on windows.
2019-09-15 10:57:27 +02:00
Alexandru Macovei fe53af064b fix most clippy lints 2019-01-26 16:15:48 +01:00
sharkdp 8cfdcf43f6 Lock stdout only once 2019-01-09 08:20:20 +01:00
sharkdp 8c197d2866 Update to new lscolors version 2019-01-08 21:28:43 +01:00
Alexandru Macovei 64e6ea9fe9 [2018 edition] run cargo fix edition and edition-idioms 2019-01-07 12:52:30 +01:00
sharkdp 4b5efa3438 Use lscolors crate
Use my new [lscolors](https://github.com/sharkdp/lscolors) crate instead
of the internal `lscolors` module

- Speeds up `LS_COLORS` querying, leading to a nice 25% performance
  improvement when
- Adds support for 24-bit colors and background colors

closes #368
closes #363
2018-12-14 23:20:18 +01: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 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
sharkdp c1ef68662c Update for new rustfmt 2018-05-14 21:00:00 +02:00
sharkdp 6a9f16e159 Run latest version of rustfmt 2018-04-13 23:13:22 +02:00
sharkdp f9a32583a5 Move is_executable to fshelper module 2018-03-25 19:48:09 +02:00
sharkdp 2cf8e7b8a5 Move is_executable to internal module 2018-03-25 18:37:50 +02:00
Pramod Bisht b1e48efc4a Addresses #246
Some implementation to search by filetype `executables`
2018-03-25 16:53:12 +02:00
sharkdp e5ee5eb7b3 Minor speedup for strip_prefix 2018-02-25 10:25:59 +01:00
sharkdp 39fb41f05a Move exit codes to 'internal' module 2018-01-03 10:00:22 +01:00