1. 25 10月, 2020 6 次提交
    • B
      Introduce EXA_ICON_SPACING environment variable · 51be9f4c
      Benjamin Sago 提交于
      This commit remove the extra space that was added between icons and file names in commit 128fadd8, and adds an option to put them back.
      
      Re-fixes GH-619 and fixes GH-541.
      51be9f4c
    • B
      Fix xtests for previous two commits · c8335922
      Benjamin Sago 提交于
      c8335922
    • B
      Prefer background colour when painting icons · 976db01b
      Benjamin 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.
      976db01b
    • B
      Make icon styles appropriate for all file types · 67a6cdd4
      Benjamin 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.
      67a6cdd4
    • B
      Move icon generation into file name module · f1e3e7c7
      Benjamin 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 a1869f20, 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.
      f1e3e7c7
    • B
      Merge branch 'view-options' · b05f18ca
      Benjamin Sago 提交于
      b05f18ca
  2. 24 10月, 2020 4 次提交
    • B
      Move common icons option to file style struct · a1869f20
      Benjamin 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.
      a1869f20
    • B
      Add icons xtests · 800c73ff
      Benjamin Sago 提交于
      800c73ff
    • B
      Make View command-line args position-dependent · fd730e43
      Benjamin 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.
      fd730e43
    • B
      a small formatting change · bf3d58aa
      Benjamin Sago 提交于
      bf3d58aa
  3. 23 10月, 2020 1 次提交
    • B
      Massive theming and view options refactor · 3419afa7
      Benjamin 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.
      3419afa7
  4. 21 10月, 2020 5 次提交
  5. 19 10月, 2020 1 次提交
  6. 18 10月, 2020 6 次提交
    • L
      Add more immediate files · bf883884
      Laurent Arnoud 提交于
      bf883884
    • B
      Make Vagrant provisioning quieter and faster · 93bd052c
      Benjamin 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
      93bd052c
    • B
      More git-ignore xtests · 06c899ca
      Benjamin Sago 提交于
      The new tests make sure that the git-ignored files are skipped in every view.
      06c899ca
    • B
      More date-related xtests · d8b21a33
      Benjamin Sago 提交于
      • Displaying accessed and modified dates
      • Displaying dates in the distant past and far future (#557)
      d8b21a33
    • B
      Fix xtests bug where git3 file date kept changing · ef7bb43d
      Benjamin Sago 提交于
      ef7bb43d
    • B
      Use Specsheet for the extended tests · 61c5df7c
      Benjamin 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.
      61c5df7c
  7. 17 10月, 2020 2 次提交
    • B
      Help text changes · 86de17b7
      Benjamin 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.
      86de17b7
    • B
      Make the Vagrant environment creation nicer · 91f1541e
      Benjamin 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.
      91f1541e
  8. 16 10月, 2020 2 次提交
  9. 15 10月, 2020 1 次提交
  10. 14 10月, 2020 3 次提交
    • B
      README REVAMP · 6ef7dba1
      Benjamin 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
      6ef7dba1
    • B
      Travis changes · 31a2eba2
      Benjamin 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
      31a2eba2
    • B
      Convert manual pages to Markdown · 6eb5cee6
      Benjamin 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.
      6eb5cee6
  11. 13 10月, 2020 7 次提交
    • B
      Clippy pedantic lints · 002080cd
      Benjamin 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.
      002080cd
    • B
      New set of lints, and Rust 2018 idioms · 3dc86c99
      Benjamin Sago 提交于
      3dc86c99
    • B
      Merge branch 'modernise' · f42957fa
      Benjamin Sago 提交于
      f42957fa
    • B
      Move Git shared state to structs · 80f9806b
      Benjamin 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.
      80f9806b
    • B
      IO import changes · ecbe63bf
      Benjamin Sago 提交于
      ecbe63bf
    • B
      Have tests use OsStrs not OsStrings · 6f2d8cc2
      Benjamin Sago 提交于
      6f2d8cc2
    • B
      Replace Misfire with a testable OptionsResult · ed59428c
      Benjamin 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.
      ed59428c
  12. 11 10月, 2020 1 次提交
    • B
      Batch source formatting · f8df02da
      Benjamin 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
      f8df02da
  13. 10 10月, 2020 1 次提交