summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-10-24Introduce EXA_ICON_SPACING environment variablebetter-iconsBenjamin Sago
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-24Fix xtests for previous two commitsBenjamin Sago
2020-10-24Prefer background colour when painting iconsBenjamin Sago
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-24Make icon styles appropriate for all file typesBenjamin Sago
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-24Move icon generation into file name moduleBenjamin Sago
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-24Merge branch 'view-options'Benjamin Sago
2020-10-23Move common icons option to file style structview-optionsBenjamin Sago
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-23Add icons xtestsBenjamin Sago
2020-10-23Make View command-line args position-dependentBenjamin Sago
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-23a small formatting changeBenjamin Sago
2020-10-22Massive theming and view options refactorBenjamin Sago
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-21Use issue templatesBenjamin Sago
2020-10-21Link to GitHub SponsorsBenjamin Sago
2020-10-20Ignore --across --long conflict not in strict modeBenjamin Sago
Fixes #476.
2020-10-20Very slight test cleaningBenjamin Sago
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-20Merge pull request #752 from spk/more-stuff-filesBenjamin Sago
Add more immediate files
2020-10-18Merge branch 'specsheet'Benjamin Sago
2020-10-18Add more immediate filesLaurent Arnoud
2020-10-18Make Vagrant provisioning quieter and fasterBenjamin Sago
• 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-17More git-ignore xtestsBenjamin Sago
The new tests make sure that the git-ignored files are skipped in every view.
2020-10-17More date-related xtestsBenjamin Sago
• Displaying accessed and modified dates • Displaying dates in the distant past and far future (#557)
2020-10-17Fix xtests bug where git3 file date kept changingBenjamin Sago
2020-10-17Use Specsheet for the extended testsBenjamin Sago
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-16Help text changesBenjamin Sago
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-16Make the Vagrant environment creation nicerBenjamin Sago
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-15Merge pull request #750 from Finermeerkat137/pullreq2Benjamin Sago
Add PKGBUILD, *.heic, and *.heif to their respective filetypes
2020-10-15Add extra coloringSudhip Nashi
2020-10-14Slightly better install instructionsBenjamin Sago
• Mention using 'just --tasks' • Mention using the '--release' flag • Mention how to build and install the man pages
2020-10-13README REVAMPBenjamin Sago
• 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-13Travis changesBenjamin Sago
• 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-13Convert manual pages to MarkdownBenjamin Sago
This removes the "raw" man pages and converts them to Markdown, adding a build step using pandoc that converts them. Having the man pages in Markdown makes them much, much easier to write and keep updated, at the cost of not having the raw formats easily available. Hopefully having the command to generate them in the Justfile will be enough. It also splits out the EXA_COLORS environment variable into its own page, because it took up just under half of the one for the exa binary.
2020-10-13Clippy pedantic lintsBenjamin Sago
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-13New set of lints, and Rust 2018 idiomsBenjamin Sago
2020-10-13Merge branch 'modernise'Benjamin Sago
2020-10-13Move Git shared state to structsBenjamin Sago
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-13IO import changesBenjamin Sago
2020-10-13Have tests use OsStrs not OsStringsBenjamin Sago
2020-10-12Replace Misfire with a testable OptionsResultBenjamin Sago
This was meant to be a small change, but it spiralled into a big one. The original intention was to separate OptionsResult and OptionsError. With these types separated, the Help and Version variants can only be returned from the Options::parse function, and the later option-parsing functions can only return success or errors. Also, Misfire was a silly name. As a side-effect of Options::parse returning OptionsResult instead of Result<Options, Misfire>, we could no longer use unwrap() or unwrap_err() to get the contents out. This commit makes OptionsResult into a value type, and Options::parse a pure function. It feels like it should be one, having its return value entirely dependent on its arguments, but it also loaded locales and time zones. These parts have been moved into lazy_static references, and the code still passes tests without much change. OptionsResult isn't PartialEq yet, because the file colouring uses a Box internally.
2020-10-10Batch source formattingBenjamin Sago
I read through every file and applied a couple of rustfmt suggestions. The brace placement and alignment of items on similar lines has been made consistent, even if neither are rustfmt's default style (a file has been put in place to enforce this). Other changes are: • Alphabetical imports and modules • Comma placement at the end of match blocks • Use newlines and indentation judiciously • Spaces around associated types • Spaces after negations (it makes it more clear imho) • Comment formatting • Use early-returns and Optional `?` where appropriate
2020-10-10Various misc clippy fixesBenjamin Sago
2020-10-10Remove some enum glob importsBenjamin Sago
These are holdovers from how I used to write Rust ("back in the day" of 2014). There are still some places in the code where I think it's worth glob-importing enums, but not these places.
2020-10-10Better referencingBenjamin Sago
This commit makes changes to the way variables are referenced: • Make types Copy when possible • Make methods take `self` instead of `&self` where possible (trivially_copy_pass_by_ref) • Remove unnecessary borrowing (needless_ref) • Remove unnecessary cloning (clone_on_copy) • Remove `ref` from match arms where possible (new Rust match ergonomics)
2020-10-10The SelfeningBenjamin Sago
This commit uses Clippy to fix all the 'use_self' warnings. Using Self instead of the type name has been good Rust style for a while now, and it's become the style I'm used to seeing.
2020-10-10Some Clippy fixesBenjamin Sago
2020-10-10Simplify type signatures in main moduleBenjamin Sago
Exa::from_args used to be in the library, called by the binary, but now the binary is gone, it no longer needs to be as abstract. Instead of accepting a reference to a Write value, it takes a Stdout directly, which it owns itself, simplifying the type signature drastically.
2020-10-10Mass version upgradeBenjamin Sago
This upgrades the versions of everything, including upgrading almost all outdated dependencies. • number_prefix had some backwards-incompatible changes. It now feels more Rustful, and spells "Mebi" correctly. • term_grid stopped working when I upgraded it, worryingly, so I reverted it back.
2020-10-10Just straight-up roll our own loggerBenjamin Sago
This commit removes the env_logger dependency, replacing it with a simple implementation. Doing so removes like ten other transitive dependencies that no longer need to be included in the build. It also gains the ability to enable trace-level logging. The users crate, which contains such logging statements as of the version I published a few days ago, has been upgraded to celebrate. Also, change the log imports to globs. I'm only interested that a file doing logging, not what level it's logging at.
2020-10-10Cargo.lock metadata changesBenjamin Sago
2020-10-10Inline the library into the binaryBenjamin Sago
This commit removes the library portion of exa. Cargo now only builds a binary. The original intent was for exa to have its own internal library, and have the binary just call the library. This is usually done for code cleanliness reasons: it separates the code that implements the purpose of the program (the "plumbing") from the code that the user interacts with (the "porcelain"), ensuring a well-defined interface between the two. However, in exa, this split was in completely the wrong place. Logging was handled in the binary, but option parsing was handled in the library. The library could theoretically print to any Writer ("for testing", it said), but it's far easier to run integration tests by executing the binary than to change the code to handle unit tests, so this abstraction isn't gaining us anything. I've also had several people ask me if exa should be packaged for Linux distributions as a library, or just a binary. Clearly, this is confusing! In several of my other Rust projects, I've done this better, with the command-line option parsing and log printing done on the binary side. It also turns out that you don't need to have a [lib] section in the Cargo.toml, so that's gone too.
2020-10-10Use 0 and 1 rather than EXIT_SUCCESS/FAILUREBenjamin Sago
It doesn't seem right to use the EXIT_SUCCESS constant in one place, and a hard-coded 2 in another. What if they overlap? Changing the success value to 0 should be OK, though, because the standard defines 0 as success, regardless of whether EXIT_SUCCESS is 0 or not. Also, the values have become i32s. The Rust function std::process::exit takes an i32, so there's not much point using anything else.