Commit Graph

862 Commits

Author SHA1 Message Date
ariasuni
efbd46351c Add a few frequent filetypes 2019-10-03 22:45:21 +02:00
Alexandru-Sergiu Marton
f6071e9c46 Fix "trait objects without an explicit dyn are deprecated" 2019-10-01 18:55:09 +03:00
Martin Sehnoutka
a7a8e99cf3 fix panic on broken symlink in git repository
The issue including reproducer is described here:
https://github.com/ogham/exa/issues/526
This commit includes proposed change as well as integration test.
2019-09-15 16:56:58 +02:00
Eric Nielsen
cb933a6f62 Remove unused code in File#get_source_files
as the "class", "elc", "hi", "o", "pyc" extensions are first tested in
FileExtensions#is_compiled, so removed code is redundant and neved
called.
2019-09-10 09:51:08 -05:00
Vicente Reyes
69a7e53ee3
include symlinks to dirs when grouping dirs
When using the option --group-directories-first, symlinks to directories
are now first too.
2019-09-04 14:16:16 -04:00
Orvar Segerström
925f5173c1 Add support for suppressing table columns 2019-08-29 14:34:30 +02:00
Grigorii Horos
f4f83f4d37
Add some icons for files 2019-08-04 05:40:28 +03:00
Grigorii Horos
f9540ead5b
Align file 2019-08-04 01:14:52 +03:00
Grigorii Horos
e45fb7a0a7
Add some icons for files 2019-08-04 00:22:42 +03:00
Grigorii Horos
0d3023657b
Add some icons for files 2019-08-03 23:41:52 +03:00
Brennan McDonald
215b779d35
Fixed copy-paste bug in access times. 2019-08-03 11:07:16 -07:00
Brennan McDonald
f19f7be726
Updated file.rs
Added checks to `file.rs` to ensure that file's metadata exists after `UNIX_EPOCH`.
If the file was accessed/modified/created after UNIX_EPOCH, the current day is displayed.
2019-07-31 15:43:31 -07:00
James Tai
dd9dffff8c Display icons when file names are too long for grid
Fixes ogham/exa#548
2019-07-30 18:33:12 -07:00
Bond_009
8b60285320 Fix build without default features 2019-07-19 20:40:21 +02:00
Bond_009
f599c7ce93 Update to Rust 2018 2019-07-19 20:40:21 +02:00
Oleksii Filonenko
58c821be6e
Add documentation for --icons flag
- Update completions
  - fish
  - zsh
- Update man page
- Update help text
2019-07-19 09:58:50 +03:00
Michael Hackner
e3fc2de088 Add BUILD.bazel as another Bazel file type
This seems to be preferred now, though both are valid.
2019-07-17 01:05:33 -07:00
Benjamin Sago
f1a5b646fe
Merge pull request #378 from LlinksRechts/master
fixed git status not working in directories containing '../'
2019-07-15 04:00:11 +01:00
Benjamin Sago
9497b30b33 Merge branch 'glyphs' of https://github.com/asoderman/exa into asoderman-glyphs
# Conflicts:
#	src/options/flags.rs
#	src/options/view.rs
#	src/output/grid.rs
2019-07-15 03:54:31 +01:00
Benjamin Sago
081bce0479 Merge branch 'fix-warnings-and-rust-2018' of https://github.com/ariasuni/exa into ariasuni-fix-warnings-and-rust-2018
# Conflicts:
#	src/fs/dir.rs
2019-07-15 03:42:33 +01:00
Benjamin Sago
9e1200f9b7 Fix failing tests 2019-07-15 03:37:05 +01:00
Benjamin Sago
faed8f9b82
Merge pull request #457 from ariasuni/fix-sorting-by-created-time
Fix sorting by created time
2019-07-15 03:30:52 +01:00
Benjamin Sago
df9b32c892 Fix a couple warnings 2019-07-13 21:17:48 +01:00
Benjamin Sago
6cd52163f7
Merge pull request #489 from benmezger/patch-1
Feat: add JPF to image filetype
2019-07-13 21:16:50 +01:00
Benjamin Sago
e936d7e09f Prevent infinite loop with -aaR
This happened because exa would recurse into `.` over and over again. There was nothing distinguishing the pseudo-entry for `.` that was being added by `--a` from a `.` passed in on the command-line, so it was looping forever.

It gets fixed by having the File value keep track of whether it’s an --all --all entry, and not recursing into directories with this field set.

Fixes #515
2019-07-13 21:14:42 +01:00
E.M. Gelblicht
1bf9e397e5 converted default formatting so single-digit hour times are 0-padded 2019-06-10 17:34:21 -07:00
Bernardo Meurer
9660048b41
Replace trim_left_matches with trim_start_matches 2019-04-16 22:54:42 -07:00
Bernardo Meurer
2d0768c8d2
Fix usages of number_prefix 2019-04-16 22:54:06 -07:00
Ben Mezger (seds)
99167429ed
Feat: add JPF to image filetype 2019-04-03 15:10:03 -03:00
ariasuni
f0e7321506 Fix and add tests 2019-03-23 17:23:43 +01:00
ariasuni
39a49a3d36 Check if the sort field is supported by the OS 2019-03-23 17:23:43 +01:00
ariasuni
56717c7336 Add “changed” sort option, to replace old incorrect “created” 2019-03-23 17:23:40 +01:00
ariasuni
b0da0c9055 Use correct metadata for created time 2019-03-23 17:18:18 +01:00
ariasuni
49ed3ed0f8 Fix clippy warnings and explicitely ignore a few, fix future deprecation 2018-12-16 20:50:37 +01:00
Benjamin Sago
058b4a57bd Bump users crate version
And remove an unnecessary allocation while we’re at it. Fixes #442
2018-12-07 00:59:05 +00:00
Benjamin Sago
2d8d8d9a5c
Merge pull request #444 from ariasuni/display-git-ignored-state
Display if a file is ignored by git
2018-12-06 21:17:48 +00:00
ariasuni
649744dc82 Use more accurate time to fix inconsistent sorting 2018-11-22 18:10:58 +01:00
ariasuni
80b0d9dd0d Display if a file is ignored by git 2018-11-20 18:12:38 +01:00
Benjamin Sago
efb0ad522c
Merge pull request #435 from teresy/shorthand-fields
refactor: use shorthand fields
2018-11-13 08:12:16 +00:00
teresy
d63917af47 refactor: use shorthand fields 2018-11-06 17:43:01 -05:00
James Reed
7218fb4b6a
Document only-dirs option 2018-10-26 17:21:31 -06:00
James Reed
89a6e14e15
Move level option to correct group 2018-10-26 17:15:48 -06:00
Benjamin Sago
57e4c08411 Highlight README~ as temp, not immediate
Fixes #313.
2018-10-14 16:21:13 +01:00
Benjamin Sago
c2bb986618 Replace Default impls that use state with fns
The Default impls for DefaultFormat and LoadFormat were originally called ‘new’, to which Clippy suggested that they be changed. But as these functions change based on what the year is, a function called something other than ‘new’, like ‘load’.
2018-10-13 22:15:10 +01:00
Benjamin Sago
ecc4138d56 Merge branch 'clippy_fixes' of https://github.com/thibran/exa into thibran-clippy_fixes
# Conflicts:
#	src/options/view.rs
#	src/style/lsc.rs
2018-10-13 22:07:35 +01:00
Benjamin Sago
8b4ebc2d6b Merge branch 'master' of github.com:ogham/exa 2018-10-08 04:00:52 +01:00
Benjamin Sago
dc2009aef4 Parse more ANSI codes
Including more styles and 24-bit foregrounds and backgrounds. Also a comment about how this is kicking the can down the road.

Fixes #347, mostly.
2018-10-08 04:00:09 +01:00
Benjamin Sago
ce3f05c4f5 Allow more zero padding in ANSI code parsing
Fixes #352
2018-10-08 03:01:15 +01:00
Lucas Rooyakkers
9b446c03e8 Add support for Apple's M4V format 2018-10-02 01:47:51 -04:00
Benjamin Sago
a4d9b5314f
Merge pull request #405 from Don42/feature_only_dirs
Flag for only showing directories
2018-09-27 21:01:15 +01:00
Benjamin Sago
3d796cf470
Merge pull request #397 from mopp/use_time_style_env_var
Use `TIME_STYLE` environment variable
2018-09-27 20:58:44 +01:00
Benjamin Sago
a8b5534d53
Merge pull request #373 from doy/directory-symlink
make exa on symlinks to directories show their contents
2018-09-26 20:58:18 +01:00
Marco 'don' Kaulea
5dffaf3076 Add period for consistency 2018-09-03 09:20:03 +02:00
Marco 'don' Kaulea
33167a2282 Add short option for only-dirs 2018-07-13 17:38:36 +02:00
Marco 'don' Kaulea
054cac6b82 Add option to only display directories
This allows printing directory trees without any files, only
showing the structure.
I haven't decided on a letter for the short option.

Implements #401
2018-07-12 18:51:14 +02:00
Thibaut Brandscheid
755876e9b6 fix most clippy warnings 2018-06-19 17:17:39 +02:00
mopp
991781070e refers TIME_STYLE environment variable if it exists and the argument is not given 2018-06-15 04:38:32 +09:00
Benjamin Sago
a3b2f2b3f4
Merge pull request #384 from spk/update-log
Update log to 0.4 and env_logger to 0.5
2018-05-28 10:50:23 +02:00
Benjamin Sago
55048f7ee2
Merge pull request #380 from kornelski/master
Replaced try!() with ?
2018-05-28 10:50:06 +02:00
Benjamin Sago
5438f949c9
Merge pull request #311 from martinlindhe/master
adjust some spelling
2018-05-28 10:47:38 +02:00
Laurent Arnoud
eff7122bb2
Update log to 0.4 and env_logger to 0.5
No change needed for ansi_term to 0.11
2018-05-03 19:40:04 +02:00
Kornel
2976b487ab Replaced try!() with ? 2018-04-18 01:16:32 +01:00
Lukas Rysavy
2fc56d45ca fixed git status not working in directories containing '../' 2018-04-13 22:23:46 +02:00
Alex Soderman
f96a45f45e fixed icons for grid details mode 2018-04-01 20:43:08 -04:00
Alex Soderman
68954f9142 Added --icons for oneline mode 2018-04-01 19:00:27 -04:00
Alex Soderman
5991bd4ab7 Added icons for --long view 2018-04-01 18:28:31 -04:00
Jesse Luehrs
9bb62fbd63 make exa on symlinks to directories show their contents
right now, `exa foo` and `exa foo/` behave differently, which is
confusing.

fixes https://github.com/ogham/exa/issues/192
2018-03-31 05:00:03 -04:00
Alex Soderman
c448b3747f added icons for video/audio/images
remove unnecessary clone
2018-03-27 13:18:49 -04:00
Alex Soderman
fd553227f0 remove underline from icon 2018-03-27 10:58:26 -04:00
Alex Soderman
217d1eefa9 moved icons functionality to grid mode 2018-03-26 17:02:05 -04:00
Alex Soderman
d962889134 Added painting to icon 2018-03-25 12:11:47 -04:00
Alex Soderman
694c4417a0 Implemented icon rendering 2018-03-24 21:18:49 -04:00
Alex Soderman
57e8802977 Added icons mode w/ prepending (icons themselves do not appear yet) 2018-03-22 19:13:02 -04:00
Alex Soderman
67f2fcc748 Added --icons flag 2018-03-20 22:30:41 -04:00
Benjamin Sago
63a1035158
Merge pull request #355 from alexmaco/performance_tweaks
Create worker threads only once (for performance)
2018-03-16 17:23:58 +00:00
Benjamin Sago
9896f9ed78
Merge pull request #343 from BenWhitehead/mix-hidden-sorting
Add new sort option `.name` and `.Name`
2018-03-16 16:46:55 +00:00
Benjamin Sago
b16a78942c
Merge pull request #366 from dguo/ts-extension
Don't treat .ts as a video file extension
2018-03-15 20:42:26 +00:00
Benjamin Sago
3614f5513d
Merge pull request #356 from joshleeb/highlight-lowercase-readme
Case Insensitive README.* Files As immediate
2018-03-15 20:41:44 +00:00
Danny Guo
e711dbc0b6
Don't treat .ts as a video file extension
It's arguably more frequently used for TypeScript files.
2018-03-14 20:34:46 -04:00
Benjamin Sago
f757300718 Upgrade libgit2
The ogham/git2-rs repository that exa uses in the Vagrant VM has also been updated. The only casualty was that some constants got namespaced.
2018-03-11 11:25:06 +00:00
Benjamin Sago
48cdf22f46
Merge pull request #345 from ogham/exa/remove-unused-import
remove unused import
2018-03-11 09:43:33 +00:00
Benjamin Sago
9bd0334d1a
Merge pull request #342 from ogham/exa/patch-1
Add Bazel and ANT files to immediate files types
2018-03-11 09:41:09 +00:00
Josh Leeb-du Toit
d9c9dbe89e Case insensitive README.* files are immediate
Files with the prefix `README` are now classified as immediate, meaning
they will be highlighted amongst other things, in a case insensitive
way.
2018-02-15 21:55:52 +11:00
Alexandru Macovei
8cbde76b4c Create worker threads only once (for performance)
This improves performance by a factor of at least 2 in large --tree workloads by avoiding the repeated creation/destruction of the pool and containing threads.
Cycling pools also encountered lots lock contention, which accounted for most of the time saved by reusing a single pool.
2018-02-14 03:59:46 +02:00
Ryan Leung
e1a4ed87f2 add #[allow(unused)] for compatibility 2018-02-01 14:52:01 +08:00
Ryan Leung
7fb0347e93 remove unused import 2018-01-31 15:05:20 +08:00
BenWhitehead
a156d96768 Add new sort option .name and .Name
Add two new sort options `.name` and `.Name` which with ignore a leading
`.` if present on the file name before sorting according to `name` and
`Name`.

This new sort is convenient if you want to list hidden and unhidden
files sorted together.
2018-01-30 15:01:56 -08:00
Marco Farrugia
c635031661
Add Bazel and ANT files to immediate files types 2018-01-28 19:26:37 -05:00
ne-sted
5fae489717 Update filetype.rs
add `zst` extension
2017-11-20 13:50:08 +02:00
Martin Lindhe
7b1ee01eb5 adjust some spelling 2017-10-31 06:24:31 +01:00
Benjamin Sago
c7497f3778 Display more information for non-release releases 2017-10-08 20:09:46 +01:00
Benjamin Sago
e154b58268 Move EXA_DEBUG variable to vars file 2017-10-08 17:24:50 +01:00
Benjamin Sago
a45bcfe058 Rename broken_arrow to broken_symlink 2017-10-08 17:08:07 +01:00
Benjamin Sago
91334d601c Use colour traits when possible 2017-10-08 17:08:07 +01:00
Benjamin Sago
59d9e90f20 Replace “mi” colour with “bO” overlay
Fixes #288, but more-or-less as a side-effect.

The “mi” key in LS_COLORS was meant to be used for a missing link path, but it wasn’t really used like that. There was also a bug where control characters in a broken symlink’s path were assumed to be underlined, because that’s what happened in the default colour scheme, but this assumption doesn’t hold when colours were disabled.

The solution to these was not to introduce another configurable colour code, but to start using _overlays_ to alter a bunch of colours at once. The “mi” code will have to be added back later.
2017-10-08 17:08:07 +01:00
Chet Gurevitch
afc9657434 Fix LS_COLORS 01 and 04 detection 2017-10-05 20:55:43 -07:00
Benjamin Sago
9cfc70f4c0 Further shortening 2017-10-02 09:45:55 +02:00
Benjamin Sago
c7748fb1f0 Make these lines less long 2017-10-02 09:43:49 +02:00
Benjamin Sago
937b325e3a Add some ignored tests for sub-globbing 2017-09-30 09:17:29 +02:00
Benjamin Sago
166d1f5e5a Glob pattern ignore tests 2017-09-30 09:17:29 +02:00
Benjamin Sago
541e6855f2 Test some actual ignore caches 2017-09-30 09:17:29 +02:00
Benjamin Sago
476299e21f A note to my future self
It’s important to capture the current behaviour, even if it ends up being totally wrong.
2017-09-30 09:17:29 +02:00
Benjamin Sago
108dc80944 Ignore comments and blank lines when ignoring 2017-09-30 09:17:29 +02:00
Benjamin Sago
7b5b02d9f1 Extract function for parsing an ignore file 2017-09-30 09:17:29 +02:00
Benjamin Sago
1f23f3f0cc Don’t ignore .gitignore errors 2017-09-30 09:17:29 +02:00
Benjamin Sago
3d3ee8fd66 Typo fix 2017-09-30 09:17:29 +02:00
Benjamin Sago
827aa8bfc3 Ignore files matched in .gitignore
This doesn’t *completely* work: it seems to have trouble with ignored paths beginning with slashes, possibly amongst others. Also, .gitignore scanning could be made more efficient.
2017-09-30 09:17:29 +02:00
Benjamin Sago
b95446d834 Thread an ignore cache through the program
!
2017-09-30 09:17:29 +02:00
Benjamin Sago
07443e87ba Add a --git-ignore option that doesn’t do anything
!!
2017-09-30 09:17:28 +02:00
Clar Charr
eda3e56e4c Add .bk extension to is_temp. 2017-09-17 23:08:25 -04:00
Mahmoud Al-Qudsi
ad02241ac2 Merge branch 'master' into optional_args 2017-09-16 14:28:24 -05:00
Benjamin Sago
4819c4721b Fix compile error with --no-default-features
Fixes #283. Also, have Travis compile without default features either, so I get warned the next time I break it.
2017-09-14 11:33:24 +01:00
Benjamin Sago
c475cccce4 Flip the new/old order, and add suggestion for -lt
I changed my mind about which way round sorting by “newest” or by “oldest” should actually go. If you’re listing a large directory, you see the last lines of the output first, so these files should be the ones with the largest whatever the sort field is. It’s about sorting *last*, not sorting *first*. Sorting by size wouldn’t say “sorts smallest files first”, it would say “sorts largest files last”. Right?

Also, add a new suggestion that warns against “ls -lt”.
2017-09-14 09:18:17 +01:00
Benjamin Sago
a8bf990674 Tie value suggestions to their arguments
This commit changes the definition of Arg so that it knows about which values it can accept, and can display them in the help text. They were already being shown in the help text, but they were passed in separately, so one argument could show two different sets of options if it wanted. Now, the argument itself knows whether there are suggestions, so it doesn’t have to be passed in separately.

This means we can use it for other things, including listing choices when an option is missed out, without having to repeat the list.

With Misfire::BadArgument now only having two fields, it’s not worth using a constructor function anymore.
2017-09-14 01:22:37 +01:00
Mahmoud Al-Qudsi
36cf5df044 Add support for optional argument/flag with optional value
TakesValue::Optional introduced which allows for an optional flag with
an optional value (equivalent to getopts' optflagopt mode).

Can be used where a default value for a modifier could exist, but the
user might prefer to override.

Will be used to implement #284, permitting --time to default to "sort by
modification date" for compatibility with GNU/posix ls but keeping
support for exa's previous behavior.
2017-09-13 18:48:59 -05:00
Benjamin Sago
1824313cda Put misfire.rs in a nicer order
The main type is now at the top.
2017-09-13 23:49:30 +01:00
Benjamin Sago
43bbf00478 Show a warning when running ‘exa -ltr’
Raised in #243 and #284. exa isn’t able to override the -t option like this, so the least it can do is detect that case (which is going to be an error case anyway) and show a suggestion.
2017-09-13 23:47:19 +01:00
Benjamin Sago
0fefc78cbb Add more modified date aliases
I don’t really see the modified date as the *modified* date, rather just the *date* field, because it’s the date field I refer to like 99.9% of the time. So now it has aliases to match.

Also are included are aliases for the reverse order, because I’d rather write “new” than “the reverse of old”.
2017-09-13 23:26:06 +01:00
Benjamin Sago
19b7780755 Fix typo in error message
It said “(Choices: (choices: this, that, other))” instead of “(choices: this, that, other)”. Also improve the same error elsewhere: options more have ‘settings’ than ‘values’.
2017-09-13 22:37:51 +01:00
Benjamin Sago
68e70bf036 Reword this comment 2017-09-13 22:12:11 +01:00
Benjamin Sago
dc45332d7b Implement file name colouring in {exa,ls}_colors
This commit adds to the parsing of the LS_COLORS and EXA_COLORS variables so that non-two-letter codes (keys other than things like ‘di’ or ‘ln’ or ‘ex’) will be treated as file name globs, and get used to colour files accordingly.

Fixes #116 for good.
2017-09-13 08:51:57 +01:00
Benjamin Sago
b86074d63b Rename Style to Styles to avoid a name clash 2017-09-13 08:44:59 +01:00
Benjamin Sago
28b4b672d4 Move FileStyle to the same options file as Colours
They are going to be deduced together (from the same environment variable) so it makes sense to put them in the same file first.
2017-09-03 19:50:40 +01:00
Benjamin Sago
4507edd734 256 colour support in ls_colors
This is more annoying than it should be because it has to work with Styles rather than with strings, which means parsing them, and parsing is always tricky business.
2017-09-03 17:05:38 +01:00
Benjamin Sago
c60ea36a31 Allow --git --tree, too
This works by checking if any of the (immediate) files being listed are under Git, and hiding the column if all aren’t.
2017-09-02 12:53:08 +01:00
Benjamin Sago
9cda05df20 Only display Git column for directories with repos
This fixes the previous commit.
2017-09-02 00:04:22 +01:00
Benjamin Sago
558b13880b Don’t pass Dirs to the Table
A Table now doesn’t need to know about (or even import) Dir, because we can just not pass the Git reference in if it shouldn’t be using it.
2017-09-01 22:52:13 +01:00
Benjamin Sago
f3c7fa500f Fix TableOptions Debug
The only field we can really show is the list of columns, and that happened to be useful this one time, so it might as well get shown!
2017-09-01 22:48:42 +01:00
Benjamin Sago
45a807a14f Redo Git implementation to allow --git --recurse
This is all a big commit because it took a lot more work than I thought it would! The commit basically moves Git repositories from being per-directory to living for the whole life of the program. This allows for several directories in the same repository to be listed in the same invocation; before, it would try to rediscover the repository each time! This is why two of the tests “broke”: it suddenly started working with --recurse.

The Dir type does now not use Git at all; because a Dir doesn’t have a Git, then a File doesn’t have one either, so the Git cache gets passed to the render functions which will put them in the Table to render them.
2017-09-01 19:13:47 +01:00
Benjamin Sago
3d4ddf8af6 Group Git repositories by their workdir
This uses the Git module’s newfound powers of getting actual GitRepo values from a factory to cache repositories a bit more. Now, when querying two directories under the same repository, it’ll open both, see that they have the same workdir, and only use the first one.
2017-08-28 23:52:21 +01:00
Benjamin Sago
62075fe984 Code and logging fix-ups 2017-08-28 18:40:52 +01:00
Benjamin Sago
040dbb2414 Use a global Git cache
This commit adds a cache for Git repositories based on the path being queried.

Its only immediate effect is that when you query the same directory twice (such as /testcases/git /testcases/git), it won’t need to check that the second one is a Git directory the second time. So, a minuscule optimisation for something you’d never do anyway? Wrong! It’s going to let us combine multiple entries over the same repository later, letting us use --tree and --recurse, because now Git scanning is behind a factory.
2017-08-28 18:11:38 +01:00
Benjamin Sago
d86fc4286b \t and \s+$ 2017-08-26 23:54:12 +01:00
Benjamin Sago
f6b7b7f298 Add exa_colors to make exa themable
This adds support for the EXA_COLORS environment variable, and defines a bunch of exa-specific two-letter codes that I pretty much made up arbitrarily that control parts of the interface.

Fixes #160, which I didn’t expect to actually fix this release cycle, but it unexpectedly became easy to do!
2017-08-26 23:17:07 +01:00
Benjamin Sago
504a0dd6b7 Stop collecting ls_colors into a hashmap
LSColors used to be built up from an iterator, and then queried later. But because the resulting HashMap gets queried in serial anyway, we might as well pass in a callback instead, saving the allocation.

This is also technically a little faster because styles that don’t map to anything (like `zz`) are no longer parsed.
2017-08-26 22:33:16 +01:00
Benjamin Sago
dd838c2dc1 Move Colours and LSColors to their own module
The ‘options’ module is allowed to depend on ‘style’, but ‘options::render’ is not.
2017-08-26 21:40:37 +01:00
Benjamin Sago
945fa1e83d Isolate and document the environment variables 2017-08-26 21:36:27 +01:00
Benjamin Sago
bf8ff3675b Move Vars into its own module 2017-08-26 20:48:51 +01:00
Benjamin Sago
bfb8a5a573 Extract trait above file name colours
This commit meddles about with both the Colours and the FileExtensions.

Even though all the renderable fields were turned into traits, the FileName struct kept on accessing fields directly on the Colours value instead of calling methods on it. It also did the usual amount of colour misappropriation (such as ‘punctuation’ instead of specifying ‘normal_arrow’)

In preparation for when custom file colours are configurable (any day now), the colourise-file-by-kind functionality (links, sockets, or directories) was separated from the colourise-file-by-name functionality (images, videos, archives). The FileStyle struct already allowed for both to be separate; it was only changed so that a type other than FileExtensions could be used instead, as long as it implements the FileColours trait. (I feel like I should re-visit the naming of all these at some point in the future)

The decision to separate the two means that FileExtensions is the one assigning the colours, rather than going through the fields on a Colours value, which have all been removed. This is why a bunch of arbitrary Styles now exist in filetype.rs.

Because the decision on which colourise-file-by-name code to use (currently just the standard extensions, or nothing if we aren’t colourising) is now determined by the Colours type (instead of being derived), it’s possible to get it wrong. And wrong it was! There was a bug where file names were colourised even though the rest of the --long output wasn’t, and this wasn’t caught by the xtests. It is now.
2017-08-26 20:43:47 +01:00
Benjamin Sago
e5e23e23c7 Use the file type colour trait methods 2017-08-26 15:29:39 +01:00
Benjamin Sago
276d18cf7c Give block and character devices different colours
There are now two device colours instead of one. Even though they’re both set to the same style for the default colour set, LS_COLORS allows the two to look different, so exa has to support it too.

It’s probably a good idea to support it anyway.
2017-08-26 14:30:33 +01:00
Benjamin Sago
bd8e9d819c Add more ls_colors colours 2017-08-26 14:04:49 +01:00
Benjamin Sago
d517e9e12b Split FileTypes into types and kinds
This separates the colours to give to files with different filesystem types (directories, links, sockets) from files with different names or extensions (images, videos, archives).

I’m not 100% sure I’ve got the terms “kind” and “type” the right way round, but whatever.

This was done because colouring files based on their name is going to be handled differently and extensibly from colouring files based on what the filesystem thinks.
2017-08-25 17:50:22 +01:00
Benjamin Sago
fb3395883e Start actually parsing ls_colors
So far it only changes the colour of a directory, but it’s a start.
2017-08-25 17:43:36 +01:00
Benjamin Sago
59edc3b6ea These tests don’t need a type
Because the macros are now specialised to the type that’s being deduce-d, we don’t need to specify what the type is every time.
2017-08-25 09:07:28 +01:00
Benjamin Sago
974ddc0e63 Tests for turning colours on/off 2017-08-25 09:03:47 +01:00
Benjamin Sago
a581c871ed Split the colours tests in two
The TerminalColours tests used half the macros, and the Colours tests used the other half. Now only the macros used are actually in scope.
2017-08-25 08:53:35 +01:00
Benjamin Sago
4907565baf Move colour options to their own file 2017-08-24 23:38:26 +01:00
Benjamin Sago
30f3c6eb00 Strict mode and tests for colour scale 2017-08-23 11:45:29 +01:00
Benjamin Sago
8b0e483c0f More ls_colors parsing 2017-08-22 18:13:21 +01:00