• Bring what's shown in the version string in line with my other projects (URL, description, git hash and date for release-mode non-final builds only, potential for colours in the future)
• Show +git or -git depending on feature status
• Tests for the above, and for checking that the command-line flag is warned about
• The spaces between icons and filenames are now coloured too
• Some icons are different
• File sizes are now more accurate
• New help text, which needed a newline at the end
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.