Commit graph

1587 commits

Author SHA1 Message Date
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
Kartavya Vashishtha b417433644
Added sudo to installation command for Linux 2021-01-19 01:46:38 +05:30
whonore cfa00bf4b2 Fix new tests 2021-01-15 16:45:54 -05:00
whonore c8ed69368e Add tests 2021-01-14 10:01:27 -05:00
whonore 2708360fb5 Apply sort order to line and grid outputs. Fix #404 2021-01-14 10:01:27 -05:00
Mélanie Chauvel 13b91cced4
Merge pull request #772 from 0xflotus/patch-2 2021-01-14 14:29:34 +01:00
0xflotus d11ac5d49b
Recognize SCSS and Stylus as source for CSS files (#770) 2021-01-14 13:54:45 +01:00
Jakub Jirutka a6ad5fa2cd
Add Alpine Linux into Installation in Readme (#767)
* Add Alpine Linux into Installation in Readme

Co-authored-by: Mélanie Chauvel <perso@hack-libre.org>
2021-01-14 13:46:48 +01: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 73e43c0700 Fix Vagrantfile and extended tests 2021-01-11 18:55:06 +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
0xflotus 7b15f32da8
feat: add support Typescript and ReasonML projects
Close #771
2020-12-16 00:08:04 +01:00
ariasuni 13c6c75d3a Tell in the man that some flags needs exa built with git support 2020-12-10 19:29:37 +01:00
ariasuni 42bc34f339 Tell if exa was compiled with git support or not when using --help 2020-12-10 19:29:33 +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 39c8c67bf6 Justfile command to run cargo-udeps 2020-10-25 11:44:11 +00:00
Benjamin Sago bfcefd3f82 Merge branch 'better-icons' 2020-10-24 19:51:34 +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 c83359225b Fix xtests for previous two commits 2020-10-24 18:43:59 +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 b05f18cae0 Merge branch 'view-options' 2020-10-24 17:53:55 +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 800c73ff24 Add icons xtests 2020-10-23 23:49:10 +01:00
Benjamin Sago fd730e436c Make View command-line args position-dependent
This commit changes the way the View (long mode, lines mode, grid mode, etc) is parsed from the command-line arguments.

Previously, it checked for long and long-grid, then tree, then lines, then grid, in that order, no matter which order the arguments were given in on the command-line. Now, it bases the view on whichever argument comes last in the list.

Unfortunately, the options-parsing code for Views is getting really complicated, but I can't see a way to simplify it while retaining the existing functionality.

It also links the parsing of DirAction to the result of parsing the View, so that you can't use tree mode if your view isn't Details. This is to fix an issue where `exa --tree --oneline` would just emit ".", because the DirAction was treating directories as files, and the argument was ".", and the View made it use lines view. Now, the --tree is ignored, as the view isn't Details.

Fixes GH-407 and GH-583.
2020-10-23 23:04:22 +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 f0c63b64ec Use issue templates 2020-10-21 16:59:44 +01:00
Benjamin Sago db6288a9bb Link to GitHub Sponsors 2020-10-21 16:57:19 +01:00
Benjamin Sago eb90b4d168 Ignore --across --long conflict not in strict mode
Fixes #476.
2020-10-20 22:48:05 +01:00
Benjamin Sago 85414b2a61 Very slight test cleaning
I'm not 100% on the way these tests are laid out, but it _is_ helpful to see all the test data aligned like that.
2020-10-20 22:42:04 +01:00
Benjamin Sago e73a8859d5
Merge pull request #752 from spk/more-stuff-files
Add more immediate files
2020-10-20 22:20:44 +01:00
Benjamin Sago 63ddab6958 Merge branch 'specsheet' 2020-10-18 22:48:02 +01:00
Laurent Arnoud bf883884ed
Add more immediate files 2020-10-18 10:41:44 +02:00
Benjamin Sago 93bd052c70 Make Vagrant provisioning quieter and faster
• Install fewer Rust components
• Silence the output of some commands
• Only locale-gen the locales we need, and only do it once

While the 'vagrant up' and 'vagrant provision' times are still very long, and these benchmarks are very variable, there's a noticeable improvement here:

• 'vagrant up' has gone from ~244s to ~223s
• 'vagrant provision' has gone from ~21s to ~7s
2020-10-18 01:19:43 +01:00
Benjamin Sago 06c899cac0 More git-ignore xtests
The new tests make sure that the git-ignored files are skipped in every view.
2020-10-17 21:59:15 +01:00
Benjamin Sago d8b21a33b5 More date-related xtests
• Displaying accessed and modified dates
• Displaying dates in the distant past and far future (#557)
2020-10-17 21:26:24 +01:00
Benjamin Sago ef7bb43dbb Fix xtests bug where git3 file date kept changing 2020-10-17 21:25:49 +01:00
Benjamin Sago 61c5df7c11 Use Specsheet for the extended tests
This commit changes the way the extended test suite is run.

Previously, there was a folder full of outputs, and a script that ran exa repeatedly to check the outputs match. This script was hacked-together, with many problems:

• It stops at the first failure, so if one test fails, you have no idea how many actually failed.
• It also didn't actually show you the diff if one was different, it just checked it.
• It combined stdout and stderr, and didn't test the exit status of exa.
• All the output file names were just whatever I felt like calling the file at the time.
• There is no way to only run a few of the tests — you have to run the whole thing each time.
• There's no feel-good overall view where you see how many tests are passing.

I started writing Specsheet to solve this problem (amongst other problems), and now, three and a half years later, it's finally ready for prime time.

The tests are now defined as data rather than as a script. The outputs have a consistent naming convention (directory_flags.ansitxt), and they check stdout, stderr, and exit status separately. Specsheet also lets simple outputs (empty, non-empty, or one-line error messages) can be written inline rather than needing to be in files.

So even though this pretty much runs the same tests as the run.sh script did, the tests are now more organised, making it easy to see where tests are missing and functionality is not being tested.
2020-10-17 21:12:18 +01:00
Benjamin Sago 86de17b788 Help text changes
This changes the --help text, and gets rid of the special behaviour for --help --long, which I thought was a really good idea at the time, but now I just think it's inconsistent and unexpected behaviour. --help should return the same help, no matter what other arguments you have typed.

Other things:
• Put --help and --version in a section
• Capitalisation consistency
• Alignment
• Move the --octal-permissions line up a bit
• Simplify the printing implementation (HelpString is now a unit struct)

This _finally_ makes all the extended tests pass.
2020-10-16 23:53:42 +01:00
Benjamin Sago 91f1541e85 Make the Vagrant environment creation nicer
Now, instead of reams of unreadable command output, we get a nice set of stages:

[ 0/13] Deleting existing test cases directory
[ 1/13] Creating file size testcases
[ 2/13] Creating file name extension testcases
[ 3/13] Creating file names testcases
[ 4/13] Creating special file kind testcases
[ 5/13] Creating symlink testcases
[ 6/13] Creating user and group testcases
[ 7/13] Creating file permission testcases
[ 8/13] Creating date and time testcases
[ 9/13] Creating extended attribute testcases
[10/13] Creating Git testcases (1/3)
[11/13] Creating Git testcases (2/3)
[12/13] Creating Git testcases (3/3)
[13/13] Creating hidden and dot file testcases

The scripts have been moved out of the Vagrantfile because it was getting long and they're more readable this way.
2020-10-16 23:41:25 +01:00
Benjamin Sago f7a3df6229
Merge pull request #750 from Finermeerkat137/pullreq2
Add PKGBUILD, *.heic, and *.heif to their respective filetypes
2020-10-15 22:40:11 +01:00
Sudhip Nashi 42b9a5802e
Add extra coloring 2020-10-15 15:38:38 -05:00
Benjamin Sago 5dfa5769c3 Slightly better install instructions
• Mention using 'just --tasks'
• Mention using the '--release' flag
• Mention how to build and install the man pages
2020-10-14 22:20:37 +01:00
Benjamin Sago 6ef7dba160 README REVAMP
• Make the README look a bit nicer, with centered text and links and badges and stuff like that. Everyone knows that software is better if it has badges in its readme
• Fix bug where the options list was unnaturally spaced
• More OS installation commands
• A couple of rephrasings
2020-10-13 21:52:08 +01:00
Benjamin Sago 31a2eba2fe Travis changes
• Modernise the Travis incantations, which have become old and faded since they were first written
• Specify a MSRV (1.42.0) and compile on more architectures
• Test the power set of features on Stable
2020-10-13 21:49:00 +01:00