1. 17 4月, 2016 2 次提交
    • B
      Source file rearrangements · efa372cb
      Benjamin Sago 提交于
      This commit moves file, dir, and the feature modules into one parent 'fs' module. Now there are three main 'areas' of the code: main and options, the filesystem-touching code, and the output-displaying code.
      
      It should be the case that nothing in 'output' touches 'std::fs'.
      efa372cb
    • B
      Update raw libc types for Rust 1.8.0 · b65043d6
      Benjamin Sago 提交于
      Fixes #108. MetadataExt now returns direct numeric types rather than platform-specific ones, so we need to adjust the functions that use these to have the new types. I've just aliased the types to specific ones so the rest of the code remains the same (file.rs is the only place that uses this)
      
      The RFC that changed this is here: https://github.com/rust-lang/rust/pull/31551
      b65043d6
  2. 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
  3. 11 4月, 2016 1 次提交
  4. 06 4月, 2016 1 次提交
  5. 01 4月, 2016 3 次提交
    • 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
    • B
      Use only the time zone data present on the system · ee4c09dd
      Ben S 提交于
      Thinking about it, it doesn't make sense to use an *external* time zone source when the program we want to compare it to, ls, uses the system one. So just use the system one.
      
      Also, handle the case where the time zone data file can't be loaded by showing the files in UTC rather than falling over and quitting.
      ee4c09dd
  6. 19 3月, 2016 1 次提交
  7. 18 3月, 2016 3 次提交
    • B
      Add --sort=Name case-insensitive sorting · 3e9616cf
      Benjamin Sago 提交于
      This uses the case-insensitive sort function in the `natord` crate to
      convert both strings to lowercase lazily, sorting them as it goes. It
      also adds tests for `--sort` in general.
      
      The case sensitivity has been made an enum so it can be reused for other
      fields (say, the file extension).
      
      See #102.
      3e9616cf
    • B
      Fix my own broken changes · d3846468
      Benjamin Sago 提交于
      - Fix visibility errors I stupidly didn't test before committing earlier
        today
      - Silence warnings about casting that were necessary for ARM
      - Update dependencies
      d3846468
    • B
      Remove unnecessary FileTypes trait · 8ef316e1
      Ben S 提交于
      8ef316e1
  8. 11 2月, 2016 5 次提交
  9. 10 2月, 2016 1 次提交
    • B
      Update packages to latest versions · 75b2748a
      Ben S 提交于
      - Users v0.5.1, which renames OSUsers to UsersCache
      - Locale v0.2, which returns to libc v0.1
      - Datetime v0.4.2, which mimics the locale update, and puts timezone definitions in:
      - Zoneinfo-data, which is needed to obtain the current timezone
      75b2748a
  10. 17 1月, 2016 2 次提交
    • B
      Fix bug where xattr '@' characters weren't shown · 4c326631
      Benjamin Sago 提交于
      The `--long` flag should show the '@' character in the permissions list if that feature has been compiled in, but only the `--extended` flag should actually show their keys, rather than just their presence.
      4c326631
    • B
      Use Mutex lock on only the users columns · 7f980935
      Benjamin Sago 提交于
      This makes use of a change in the `users` crate to change which parts of exa's code are accessed under a `Mutex`. The change is that the methods on `Users` can now take just `&self`, instead of `&mut self`. This has a knock-on effect in exa, as many methods now don't need to take a mutable `&self`, meaning that the Mutex can be moved to only containing the users information instead of having to be queried for *every column*. This means that threading should now be a lot faster, as fewer parts have to be executed on a single thread.
      
      The main change to facilitate this is that `Table`'s structure has changed: everything environmental that gets loaded at the beginning is now in an `Environment` struct, which can be mocked out if necessary, as one of `Table`'s fields. (They were kind of in a variety of places before.)
      
      Casualties include having to make some of the test code more verbose, as it explicitly takes the columns and environment as references rather than values, and those both need to be put on the stack beforehand. Also, all the colours are now hidden behind an `opts` field, so a lot of the rendering code is more verbose too (but not greatly so).
      7f980935
  11. 22 12月, 2015 4 次提交
  12. 20 12月, 2015 1 次提交
    • B
      Move colours module into output · 1b3492ce
      Benjamin Sago 提交于
      This commit moves the colours module to be a sub-module of the output one.
      This makes sense because finding which colour a certain file should be is only
      done during output, and (I think) the only places that the `Colours` struct's
      fields are ever queried is from the output module.
      
      The only casualty was that the `file_colour` from the filetype module had to
      be moved, as determining colours is no longer part of that module - only
      determining filetype is. So it now reflects its name!
      1b3492ce
  13. 17 12月, 2015 5 次提交
    • B
      Turn TextCellContents into a struct · 15cd67ab
      Benjamin Sago 提交于
      The benefit of this is that it make it possible to convert text cell contents
      vectors into text cells with a method (see next commit). Casualties include
      having to call `.into()` on vectors everywhere, which I'm not convinced is a
      bad thing.
      15cd67ab
    • B
      Rename cell 'length' to 'width' · 39aa2104
      Benjamin Sago 提交于
      Because, strictly speaking, it's not a length, it's a width!
      
      Also, re-order some struct constructors so that they're no longer
      order-dependent (it's no longer the case that a value will be borrowed for one
      field then consumed in another, meaning they have to be ordered in a certain
      way to compile. Now the value is just worked out beforehand and the fields can
      be specified in any order)
      39aa2104
    • 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
  14. 16 12月, 2015 1 次提交
  15. 14 12月, 2015 3 次提交
    • J
      Move CString to where it's actually used · 92328d90
      Jan Beich 提交于
      src/feature/xattr.rs:6:5: 6:22 warning: unused import, #[warn(unused_imports)] on by default
      src/feature/xattr.rs:6 use std::ffi::CString;
                                 ^~~~~~~~~~~~~~~~~
      92328d90
    • J
      Fix logic inversion with --git in --help · b35927f2
      Jan Beich 提交于
      $ exa --help
      [...]
        -@, --extended     display extended attribute keys and sizes
      
      $ exa -@
      Unrecognized option: '@'.
      
      $ exa --extended
      Unrecognized option: 'extended'.
      
      $ exa --git
      Option --git is useless without option --long.
      
      $ exa -l --git
      .rw-r--r--  11k user 10 Dec 18:26 -- Cargo.lock
      [...]
      b35927f2
    • J
      Fix getting tty window size on more BSDs · b9eb3648
      Jan Beich 提交于
      src/term.rs:37:39: 37:49 error: unresolved name `TIOCGWINSZ` [E0425]
      src/term.rs:37     let result = ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window);
                                                           ^~~~~~~~~~
      b9eb3648
  16. 11 12月, 2015 1 次提交
  17. 19 11月, 2015 3 次提交
  18. 16 11月, 2015 2 次提交
    • B
      Rearrange trait definitions in options · ceae7e74
      Ben S 提交于
      This puts the impls for the structs defined in the module first, then impls for the structs defined in the columns module second.
      ceae7e74
    • B
      Use lazy_static to cache datetime formats · e07992d0
      Ben S 提交于
      One of those two date formats was re-compiled before any date was displayed. Now they are compiled only the first time they're used, and cached versions are used thereafter, resulting in a speedup.
      e07992d0