Commit Graph

376 Commits

Author SHA1 Message Date
Bastien Orivel
af208285e8 Update term_grid to 0.2 2021-12-10 13:21:13 +01:00
jim4067
4220b6f41e add lz4 file type and icon 2021-10-03 13:16:47 +03:00
Mélanie Chauvel
a7aca35d97
Merge pull request #957 from hellosway/patch-1
Recognize .jxl and .avif as image files
2021-10-03 01:11:01 +02:00
jim4067
247d1345e7 fix: add compression icon to .tXX files #930 2021-10-02 20:05:32 +03:00
hellosway
1c36b71779
Add avif and jxl icons 2021-09-27 16:36:17 -07:00
Joshua Gawley
11793973fe
Add Makefile icon (#945)
* Add icon for .mk files
* Updated icon for Makefile
2021-09-03 18:10:15 +02:00
a1346054
2bef43fb1b fix whitespace 2021-08-14 22:05:22 +00:00
xxkfqz
8de5b97804 fix: more JPG extensions 2021-07-02 15:02:06 +05:00
Matthew Gleich
56c78400b8
feat: add sty file
Signed-off-by: Matthew Gleich <git@mattglei.ch>
2021-05-18 00:12:17 -04:00
ariasuni
045172bd9e Fix all remaining clippy warnings
- Allow clippy::cast_*: generated warnings are mostly useless
- Fix the other warnings so using clippy is actually useful
2021-05-08 18:09:35 +02:00
Christian Göttsche
61ec153bcd Cleanup clippy warnings
warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
 --> src/output/escape.rs:4:1
  |
4 | pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, bad: Style) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |

warning: this lifetime isn't used in the function definition
 --> src/output/escape.rs:4:15
  |
4 | pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'_>>, good: Style, bad: Style) {
  |               ^^
  |

warning: single-character string constant used as pattern
   --> src/output/table.rs:310:41
    |
310 |                     if file.starts_with(":") {
    |                                         ^^^ help: try using a `char` instead: `':'`
    |

warning: single-character string constant used as pattern
   --> src/output/table.rs:310:41
    |
310 |                     if file.starts_with(":") {
    |                                         ^^^ help: try using a `char` instead: `':'`
    |

warning: methods called `new` usually return `Self`
  --> src/output/render/git.rs:38:5
   |
38 |     fn new(&self) -> Style;
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |

warning: this lifetime isn't used in the function definition
  --> src/output/icons.rs:40:22
   |
40 | pub fn iconify_style<'a>(style: Style) -> Style {
   |                      ^^
   |

warning: lint `clippy::find_map` has been removed: this lint has been replaced by `manual_find_map`, a more specific lint
  --> src/main.rs:11:10
   |
11 | #![allow(clippy::find_map)]
   |          ^^^^^^^^^^^^^^^^
   |

warning: redundant else block
   --> src/fs/dir.rs:124:18
    |
124 |               else {
    |  __________________^
125 | |                 return None
126 | |             }
    | |_____________^
    |

warning: redundant else block
  --> src/options/view.rs:60:18
   |
60 |               else {
   |  __________________^
61 | |                 // the --tree case is handled by the DirAction parser later
62 | |                 return Ok(Self::Details(details));
63 | |             }
   | |_____________^
   |

warning: all variants have the same postfix: `Bytes`
   --> src/output/table.rs:170:1
    |
170 | / pub enum SizeFormat {
171 | |
172 | |     /// Format the file size using **decimal** prefixes, such as “kilo”,
173 | |     /// “mega”, or “giga”.
...   |
181 | |     JustBytes,
182 | | }
    | |_^
    |

warning: all variants have the same postfix: `Bytes`
   --> src/output/table.rs:171:1
    |
171 | / pub enum SizeFormat {
172 | |
173 | |     /// Format the file size using **decimal** prefixes, such as “kilo”,
174 | |     /// “mega”, or “giga”.
...   |
182 | |     JustBytes,
183 | | }
    | |_^
    |

warning: useless use of `format!`
   --> src/options/mod.rs:181:50
    |
181 |               return Err(OptionsError::Unsupported(format!(
    |  __________________________________________________^
182 | |                 "Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa"
183 | |             )));
    | |_____________^ help: consider using `.to_string()`: `"Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa".to_string()`
    |

warning: stripping a prefix manually
   --> src/fs/filter.rs:287:33
    |
287 |         if n.starts_with('.') { &n[1..] }
    |                                 ^^^^^^^
    |

warning: case-sensitive file extension comparison
  --> src/info/filetype.rs:24:19
   |
24 |         file.name.ends_with(".ninja") ||
   |                   ^^^^^^^^^^^^^^^^^^^
   |
2021-04-30 15:37:31 +02:00
Mélanie Chauvel
95682f5674
Merge pull request #858 from Prunkles/master
Add F# icons
2021-04-27 01:01:41 +02:00
ariasuni
a85c72e2a0 Replace unmaintained crate term_size by terminal_size 2021-04-27 00:16:25 +02:00
Prunkles
7a26b4e0f7 Add F# icons 2021-04-26 08:05:05 +03:00
Benjamin Sago
e3e776a1fa Use better icon for TeX files
Fixes GH-777.
2021-04-12 22:23:51 +01:00
Benjamin Sago
dbd11d3804 Add classify char to symlink targets
Fixes GH-589.
2021-04-12 22:02:30 +01:00
Benjamin Sago
e86f2b938b
Merge pull request #837 from ariasuni/fix-month-name-not-translated
Fix month name not following locale when date is in current year
2021-04-09 23:11:28 +01:00
ariasuni
3a8005c840 Fix month name not following locale when date is in current year 2021-04-09 17:54:18 +02:00
ariasuni
c729e226da Fix EXA_GRID_ROWS not working in some cases 2021-04-09 17:48:00 +02:00
ariasuni
7a4cde75eb Use thousand separators again and fix alignement when it’s not ASCII 2021-04-06 16:23:30 +02:00
Benjamin Sago
c1435411c3
Merge pull request #813 from b05902132/numeric_gid_uid
Add options for -n or --numeric-gid-uid.
2021-04-01 09:18:59 +01:00
Benjamin Sago
f27fb2ab7a
Merge pull request #822 from ariasuni/fix-exa-rounding
Fix a rounding error in human readable filesizes
2021-03-30 14:50:29 +01:00
Benjamin Sago
96e3f3d8d3
Merge pull request #818 from PatriotRossii/feature/determine_time_zone
Update determine_time_zone according to GNU manual
2021-03-30 14:49:48 +01:00
Benjamin Sago
96e9307b99
Merge pull request #790 from ariasuni/fix-too-many-headers-in-grid-details
Don’t produce extra column sometimes with long grid + header
2021-03-30 14:37:52 +01:00
Benjamin Sago
3c69169993
Merge pull request #784 from ariasuni/fix-icons-not-showing-right-in-konsole
Use same styling for spaces between icon and file name
2021-03-30 00:18:39 +01:00
Benjamin Sago
e6edb888a0
Merge pull request #762 from ariasuni/warm-when-git-feature-is-disabled
Warm when git feature is disabled instead of ignoring flags
2021-03-29 23:51:30 +01:00
Benjamin Sago
005a174e60
Merge pull request #759 from stuartcarnie/sgc/icons
feat: New Icons and CLI argument to suppress icons
2021-03-29 23:09:26 +01:00
ariasuni
74ecf6d311 Fix a rounding error in human readable filesizes 2021-03-27 18:54:00 +01:00
PatriotRossii
4e5e2ce8f0
Replace "replace" with "replacen" 2021-03-25 11:20:11 +05:00
PatriotRossii
5743e6d8e3
Replace strip_prefix with replace 2021-03-24 19:05:38 +05:00
PatriotRossii
57cf0f1b23 Update determine_time_zone according to GNU manual 2021-03-24 17:36:13 +05:00
b05902132
4ea79ee11d Add options for -n or --numeric-gid-uid.
This option is only avaialable in -l.
There's test for rendering, but no test for option parsing.
(I don't understand that section of code.)
2021-03-19 09:49:17 +08:00
Stuart Carnie
c946bab08e
chore: PR feedback 2021-02-28 07:48:00 +11:00
Stuart Carnie
765fcf64c9
Update src/output/icons.rs
Co-authored-by: Mélanie Chauvel <perso@hack-libre.org>
2021-02-28 07:43:42 +11:00
Stuart Carnie
c42e0b3945
feat: New Icons and CLI argument to suppress icons 2021-02-28 07:18:17 +11:00
whonore
2708360fb5 Apply sort order to line and grid outputs. Fix #404 2021-01-14 10:01:27 -05:00
ariasuni
0f414cf0b9 Don’t produce extra column sometimes with long grid + header
The number of necessary columns was computed by producing a grid in different sizes and see if all columns were used. However, if there was two files and we tried to fit them in a 3-column grid, it would produces three headers and all three columns would be used; when trying a 4-column grid, the two supplementary headers would fill the third column and the fourth would be empty; so 3 columns would be used.

Now, when the grid fits into the terminal and the number of columns is exactly the number of files to display, it returns immediately instead of trying bigger grids.

Fixes GH-436.
2021-01-12 20:18:19 +01:00
ariasuni
79bac416f6 Use same styling for spaces between icon and file name
This is only visible when selecting both icon and file name, as most terminal emulators then invert background and foreground color.

It also workaround a Konsole bug: https://bugs.kde.org/show_bug.cgi?id=422776
2021-01-03 22:44:16 +01:00
ariasuni
a740512014 Warm when git feature is disabled instead of ignoring flags
The flags --git and --git-ignore are caught early during options parsing, so no more checking for git feature is done elsewhere.

Since --git-ignore depends on git too since recently, remove it from help when git feature is disabled.

Extended attributes now don’t artificially depends on git feature being enabled.
2020-12-10 18:48:58 +01:00
Benjamin Sago
51be9f4c43 Introduce EXA_ICON_SPACING environment variable
This commit remove the extra space that was added between icons and file names in commit 128fadd, and adds an option to put them back.

Re-fixes GH-619 and fixes GH-541.
2020-10-24 19:41:07 +01:00
Benjamin Sago
976db01b3e Prefer background colour when painting icons
The rationale here is that there's more of a background colour than the foreground colour when painting text, and having a gap of no background colour in between the icon and the file name looks weird.

Fixes GH-561.
2020-10-24 18:29:28 +01:00
Benjamin Sago
67a6cdd46a Make icon styles appropriate for all file types
exa now bases the icon style for a file on its file name and kind in all cases, rather than just on its file name. This means that directories and symlinks have the correctly-coloured icon.

It also only takes the foreground colour into account while styling the icon, to make sure they're not bold or underlined.

Fixes GH-528.
2020-10-24 18:16:38 +01:00
Benjamin Sago
f1e3e7c7ff Move icon generation into file name module
This commit makes adding icons to file names something that the file name renderer does, rather than something that each individual view does. This is now possible thanks to the previous commit a1869f2, which moved the option to do this into the same module. The repeated code has been removed.

It happens to fix a bug where the width of each column was being incorrectly calculated for the grid-details view, making lines slightly too long for the terminal because the icon wasn't being taken into account.
2020-10-24 18:03:36 +01:00
Benjamin Sago
a1869f208e Move common icons option to file style struct
All four of the view mode command-line argument parsers tested for the --icons option. Because it was common, the behaviour has been moved to the struct that handles file styles, meaning it can be parsed in one place.

This is a better place for it, as the icons are to do with the file name, not the view. It also means that the lines view has no options left for it, which is fitting.
2020-10-23 23:57:10 +01:00
Benjamin Sago
bf3d58aa80 a small formatting change 2020-10-23 22:32:16 +01:00
Benjamin Sago
3419afa7cf Massive theming and view options refactor
This commit significantly refactors the way that options are parsed. It introduces the Theme type which contains both styling and extension configuration, converts the option-parsing process into a being a pure function, and removes some rather gnarly old code.

The main purpose of the refactoring is to fix GH-318, "Tests fail when not connected to a terminal". Even though exa was compiling fine on my machine and on Travis, it was failing for automated build scripts. This was because of what the option-parsing code was trying to accomplish: it wasn't just providing a struct of the user's settings, it was also checking the terminal, providing a View directly.

This has been changed so that the options module now _only_ looks at the command-line arguments and environment variables. Instead of returning a View, it returns the user's _preference_, and it's then up to the 'main' module to examine the terminal width and figure out if the view is doable, downgrading it if necessary.

The code that used to determine the view was horrible and I'm pleased it can be cut out. Also, the terminal width used to be in a lazy_static because it was queried multiple times, and now it's not in one because it's only queried once, which is a good sign for things going in the right direction.

There are also some naming and organisational changes around themes. The blanket terms "Colours" and "Styles" have been yeeted in favour of "Theme", which handles both extensions and UI colours. The FileStyle struct has been replaced with file_name::Options, making it similar to the views in how it has an Options struct and a Render struct.

Finally, eight unit tests have been removed because they turned out to be redundant (testing --colour and --color) after examining the tangled code, and the default theme has been put in its own file in preparation for more themes.
2020-10-22 22:34:00 +01:00
Benjamin Sago
002080cde8 Clippy pedantic lints
This commit fixes a couple of Clippy warnings, and adds the list of lints we're OK with.

It does raise some important warnings, such as those to do with casting, which aren't allowed so they can be fixed later.
2020-10-13 01:46:17 +01:00
Benjamin Sago
3dc86c99ad New set of lints, and Rust 2018 idioms 2020-10-13 01:36:41 +01:00
Benjamin Sago
80f9806bbc Move Git shared state to structs
This was being passed around everywhere as a parameter, when it can exist just as nicely as a struct field. This means many functions can take one argument less.
2020-10-13 01:28:42 +01:00
Benjamin Sago
ecbe63bf1e IO import changes 2020-10-13 00:54:06 +01:00