1. 01 4月, 2017 1 次提交
  2. 30 10月, 2016 1 次提交
    • B
      Properly handle errors when following a symlink · 74358c18
      Ben S 提交于
      Fixes #123. The code assumes that every File that has its link_target() method called would first have been checked to make sure it’s actually a link first. Unfortunately it also assumed that the only thing that can go wrong while following a link is if the file wasn’t a link, meaning it crashes when given a link it doesn’t have permission to follow.
      
      This makes the file_target() method able to return either a file or path for displaying, as before, but also an IO error for when things go wrong.
      74358c18
  3. 14 6月, 2016 1 次提交
  4. 11 6月, 2016 1 次提交
  5. 17 4月, 2016 4 次提交
  6. 12 4月, 2016 1 次提交
    • B
      Print the parent path for passed-in files · 9b87ef1d
      Benjamin Sago 提交于
      This commit changes all the views to accommodate printing each path's prefix, if it has one.
      
      Previously, each file was stripped of its ancestry, leaving only its file name to be displayed. So running "exa /usr/bin/*" would display only filenames, while running "ls /usr/bin/*" would display each file prefixed with "/usr/bin/". But running "ls /usr/bin/" -- without the glob -- would run ls on just the directory, printing out the file names with no prefix or anything.
      
      This functionality turned out to be useful in quite a few situations: firstly, if the user passes in files from different directories, it would be hard to tell where they came from (especially if they have the same name, such as find | xargs). Secondly, this also applied when following symlinks, making it unclear exactly which file a symlink would be pointing to.
      
      The reason that it did it this way beforehand was that I didn't think of these use-cases, rather than for any technical reason; this new method should not have any drawbacks save making the output slightly wider in a few cases. Compatibility with ls is also a big plus.
      
      Fixes #104, and relates to #88 and #92.
      9b87ef1d
  7. 01 4月, 2016 2 次提交
    • B
      Always sort files the same way · f6c5c89f
      Ben S 提交于
      This fixes a bug where extra sorting options (dirs first, reverse) were not applied when listing in long mode. In other words, fixes #105.
      
      The bug occurred because the sorting function only took Files, but the details view uses File eggs that only contain Files. This commit changes the sorting function to accept anything that AsRefs to File, and impls that on both File and Egg so the same function works for both.
      f6c5c89f
    • B
      Replace deprecated raw types with libc ones · eaa799c6
      Ben S 提交于
      This limits it to stable until the APIs stabilise (weird, huh?)
      eaa799c6
  8. 17 12月, 2015 3 次提交
    • B
      Remove dependency between file and output mods · 88653a00
      Benjamin Sago 提交于
      By removing the `File#file_name_width` method, we can make the file module
      have no dependency on the output module -- in other words, the model (file)
      and the view (output) are now separate again!
      88653a00
    • B
      Encapsulate "display width" in a struct · 4c2bf2f2
      Benjamin Sago 提交于
      This commit introduces the `output::cell::DisplayWidth` struct, which
      encapsulates the Unicode *display width* of a string in a struct that makes it
      less easily confused with the *length* of a string.
      
      The use of this type means that it's now harder to accidentally use a string's
      length-in-bytes as its width. I've fixed at least one case in the code where
      this was being done!
      
      The only casualty is that it introduces a dependency on the output module from
      the file module, which will be removed next commit.
      4c2bf2f2
    • B
      Replace Cells with growable TextCells · c911b5f6
      Benjamin Sago 提交于
      A recent change to ansi-term [1] means that `ANSIString`s can now hold either
      owned *or* borrowed data (Rust calls this the Cow type). This means that we
      can delay formatting ANSIStrings into ANSI-control-code-formatted strings
      until it's absolutely necessary. The process for doing this was:
      
      1. Replace the `Cell` type with a `TextCell` type that holds a vector of
         `ANSIString` values instead of a formatted string. It still does the
         width tracking.
      
      2. Rework the details module's `render` functions to emit values of this
         type.
      
      3. Similarly, rework the functions that produce cells containing filenames
         to use a `File` value's `name` field, which is an owned `String` that
         can now be re-used.
      
      4. Update the printing, formatting, and width-calculating code in the
         details and grid-details views to produce a table by adding vectors
         together instead of adding strings together, delaying the formatting as
         long as it can.
      
      This results in fewer allocations (as fewer `String` values are produced), and
      makes the API tidier (as fewer `String` values are being passed around without
      having their contents specified).
      
      This also paves the way to Windows support, or at least support for
      non-ANSI terminals: by delaying the time until strings are formatted,
      it'll now be easier to change *how* they are formatted.
      
      Casualties include:
      
      - Bump to ansi_term v0.7.1, which impls `PartialEq` and `Debug` on
        `ANSIString`.
      - The grid_details and lines views now need to take a vector of files, rather
        than a borrowed slice, so the filename cells produced now own the filename
        strings that get taken from files.
      - Fixed the signature of `File#link_target` to specify that the
        file produced refers to the same directory, rather than some phantom
        directory with the same lifetime as the file. (This was wrong from the
        start, but it broke nothing until now)
      
      References:
      
      [1]: ansi-term@f6a6579ba8174de1cae64d181ec04af32ba2a4f0
      c911b5f6
  9. 16 12月, 2015 1 次提交
  10. 16 11月, 2015 1 次提交
    • B
      Move time type picking to details module · 590fb9cd
      Ben S 提交于
      Technically speaking, picking which timestamp to show for a file is a function of an output module, rather than the file itself. This also means that the `output::column` and `file` modules are now completely separate.
      590fb9cd
  11. 15 11月, 2015 1 次提交
    • B
      Move many Options structs to the output module · 10468797
      Ben S 提交于
      This cleans up the options module, moving the structs that were *only* in use for the columns view out of it.
      
      The new OptionSet trait is used to add the ‘deduce’ methods that used to be present on the values.
      10468797
  12. 04 11月, 2015 4 次提交
  13. 04 9月, 2015 1 次提交
  14. 03 9月, 2015 3 次提交
    • B
      Remove redundant attribute field · 83f05ffb
      Ben S 提交于
      83f05ffb
    • B
      Rename readdir -> read_dir · 4424a6df
      Ben S 提交于
      4424a6df
    • B
      Parallelise the details view! · 4e49b91d
      Ben S 提交于
      This commit removes the threadpool in `main.rs` that stats each command-line argument separately, and replaces it with a *scoped* threadpool in `options/details.rs` that builds the table in parallel! Running this on my machine halves the execution time when tree-ing my entire home directory (which isn't exactly a common occurrence, but it's the only way to give exa a large running time)
      
      The statting will be added back in parallel at a later stage. This was facilitated by the previous changes to recursion that made it easier to deal with.
      
      There's a lot of large sweeping architectural changes. Here's a smattering of them:
      
      - In `main.rs`, the files are now passed around as vectors of files rather than array slices of files. This is because `File`s aren't `Clone`, and the `Vec` is necessary to give away ownership of the files at the appropriate point.
      - In the details view, files are now sorted *all* the time, rather than obeying the command-line order. As they're run in parallel, they have no guaranteed order anyway, so we *have* to sort them again. (I'm not sure if this should be the intended behaviour or not!) This means that the `Details` struct has to have the filter *all* the time, not only while recursing, so it's been moved out of the `recurse` field.
      - We use `scoped_threadpool` over `threadpool`, a recent addition. It's only safely used on Nightly, which we're using anyway, so that's OK!
      - Removed a bunch of out-of-date comments.
      
      This also fixes #77, mainly by accident :)
      4e49b91d
  15. 26 8月, 2015 3 次提交
    • B
      Scan for nested files on-demand, not all the time · b5edee53
      Ben S 提交于
      This does a similar thing that we did with the xattrs, except with the nested files: it removes the 'this' field on File, and replaces it with a method (to_dir) that has the same effect.
      
      This means we get to remove a bunch of 'recurse' fields and parameters that really had no business being there! Now the table doesn't need to know whether it's going to need to list files recursively or not.
      b5edee53
    • B
      Print xattrs in tree view like we do errors · 69b22a0d
      Ben S 提交于
      This changes the way extended attributes (xattrs) are printed. Before, they were artificially printed out on their own line both in lines mode *and* details mode, which looked a bit weird. Now, they are additional 'child nodes' of that item that get printed alongside errors.
      
      All this allows all the 'extra info' that is going to be present for very few entries to be consolidated and listed in the same way, without resorting to extra printlns.
      
      As a great side-effect, it allows taking out some of the more redundant code in the Table impl -- it is now *always* going to be in create-child-nodes mode, as *any* file now can, not only when we have the --tree flag in use.
      
      Also, it now actually displays errors when failing to read the extended attributes, such as if the user doesn't have permission to read them.
      
      The extended attribute flag has been temporarily disabled while I work out the best way to do it!
      69b22a0d
    • B
      Coalesce platform-specific xattr modules · a250f212
      Ben S 提交于
      Now we have one Ur-module that contains functionality common to both supported platforms.
      
      The benefits of doing it this way are that:
      
      1. It doesn't implement a dummy interface - rather, there will be less code generated when the feature is not present;
      2. The code shared between them can be kept in sync. The other two modules were something like 80% the same.
      a250f212
  16. 25 8月, 2015 1 次提交
    • B
      Display errors inline in the tree · 2a9b6fe9
      Ben S 提交于
      When tree mode is active, this will print out errors as another form of child node in the tree, instead of in one big block before any output.
      
      The 'this' field now holds the io::Result of the readdir call, rather than only a *successful* result.
      2a9b6fe9
  17. 04 8月, 2015 1 次提交
    • B
      Fix bug where Git repos were always queried · d547c3f5
      Ben S 提交于
      This is very slow (see #28) at the moment, so there's an option to switch off repo discovery. However, they were still always being queried. Now, if there's no Git option in the flags, it won't try to discover a repo.
      d547c3f5
  18. 02 8月, 2015 1 次提交
    • B
      Use new slice_splits functions · 21ee2fbb
      Ben S 提交于
      These replace `init()` and `tail()` which are deprecated in favour of these.
      
      In fact, it's a good thing they're deprecated, because part of the path_prefix code involved working around a call to init() that would panic otherwise - doing the same check with an `Option` is much more ergonomic.
      21ee2fbb
  19. 17 6月, 2015 1 次提交
  20. 09 6月, 2015 1 次提交
  21. 17 5月, 2015 2 次提交
  22. 16 5月, 2015 1 次提交
  23. 12 5月, 2015 4 次提交