1. 10 8月, 2017 1 次提交
  2. 09 8月, 2017 2 次提交
    • B
      Decouple assert_eq! and assert_parses · 0b87392f
      Benjamin Sago 提交于
      The assert_parses function was problematic because it insisted on using assert_eq! to check its contents. This won’t work for any type we want to test that doesn’t implement PartialEq, such as TimeFormat, which holds references to years and date strings and other such.
      
      To go about fixing this, the first step is to change that function so it only does the initial processing, rather than the assertion, which is now done outside of it in the test macros instead.
      0b87392f
    • B
      Be stricter in strict mode · ff497b52
      Benjamin Sago 提交于
      Now the code actually starts to use the Strictness flag that was added in the earlier commit! Well, the *code* doesn’t, but the tests do: the macros that create the test cases now have a parameter for which tests they should run. It’s usually ‘Both’ for both strict mode and default mode, but can be specified to only run in one, for when the results differ (usually when options override one another)
      
      The downside to strict mode is that, now, *any* call to `matches.has` or `matches.get` could fail, because an option could have been specified twice, and this is the place where those are checked for. This makes the code a little less ergonomic in places, but that’s what the ? operator is for. The only place this has really had an effect is in `Classify::deduce`, which used to just return a boolean but can now fail.
      
      In order to more thoroughly test the mode, some of the older parts of the code can now act more strict. For example, `TerminalColours::deduce` will now use the last-given option rather than searching for “colours” before “colors”.
      
      Help and Version continue doing their own thing.
      ff497b52
  3. 08 8月, 2017 1 次提交
    • B
      Thread Strictness through the parser · 00379cce
      Benjamin Sago 提交于
      The value is ignored, but this broke quite a lot of tests that assumed MatchedFlags had only one field.
      
      Parsing tests have to have OsStr flags because I couldn’t get that part working right, but in general, some tests now re-use common functionality too.
      00379cce
  4. 06 8月, 2017 4 次提交
    • B
      Allow xattrs to be shown in --tree without --long · 89540edb
      Benjamin Sago 提交于
      This restriction was originally only there because a standalone --tree wasn’t a thing. Now it’s there, there’s no reason to forbid the combination.
      89540edb
    • B
      Specify that we need the width of stdout · 4289f4d2
      Benjamin Sago 提交于
      The term_size crate introduced in #237 did things *slightly* differently than exa: it tried to get the terminal width of stdout, stderr, and stdin. This broke some tests that only redirected stdout.
      4289f4d2
    • B
      Separate the matched flags from the free strings · 9872eba8
      Benjamin Sago 提交于
      Originally, both the matched flags and the list of free strings were returned from the parsing function and then passed around to every type that had a ‘deduce’ method. This worked, but the list of free strings was carried around with it, never used.
      
      Now, only the flags are passed around. They’re in a new struct which has the methods the Matches had.
      
      Both of Matches’s fields are now just data, and all of the methods on MatchedFlags don’t ignore any fields, so it’s more cohesive, at least I think that’s the word.
      
      Building up the MatchedFlags is a bit more annoying though because the vector is now hidden behind a field.
      9872eba8
    • B
      Document and organise the parser module · 0456e7cf
      Benjamin Sago 提交于
      0456e7cf
  5. 05 8月, 2017 2 次提交
  6. 27 7月, 2017 3 次提交
    • B
      Add some tests for the time flags · 06157fde
      Benjamin Sago 提交于
      Apparently I forgot to give the --time flag an argument, and this wasn’t actually covered by any of the xtests! Well, it’s tested now.
      
      I’m not sure how to handle multiple --time arguments.
      06157fde
    • B
      Add tests for size format · 817c7d23
      Benjamin Sago 提交于
      817c7d23
    • B
      Switch to the new options parser · 2d1f462b
      Benjamin Sago 提交于
      This commit removes the dependency on the ‘getopts’ crate entirely, and re-writes all its uses to use the new options parser instead.
      
      As expected there are casualties galore:
      
      - We now need to collect the options into a vector at the start, so we can use references to them, knowing they’ll be stored *somewhere*.
      - Because OsString isn’t Display, its Debug impl gets used instead. (This is hopefully temporary)
      - Options that take values (such as ‘sort’ or ‘time-style’) now parse those values with ‘to_string_lossy’. The ‘lossy’ part means “I’m at a loss for what to do here”
      - Error messages got a lot worse, but “--tree --all --all” is now a special case of error rather than just another Misfire::Useless.
      - Some tests had to be re-written to deal with the fact that the parser works with references.
      - ParseError loses its lifetime and owns its contents, to avoid having to attach <'a> to Misfire.
      - The parser now takes an iterator instead of a slice.
      - OsStrings can’t be ‘match’ patterns, so the code devolves to using long Eq chains instead.
      - Make a change to the xtest that assumed an input argument with invalid UTF-8 in was always an error to stderr, when that now in fact works!
      - Fix a bug in Vagrant where ‘exa’ and ‘rexa’ didn’t properly escape filenames with spaces in.
      2d1f462b
  7. 24 7月, 2017 1 次提交
    • B
      Move filter and dir_action from options to fs · 5b1966d2
      Benjamin Sago 提交于
      This commit moves the definitions of Filter and DirAction from the options module to the fs module, but leaves the parts that actually have to do with option parsing alone.
      
      Now, the options module shouldn’t define any types that get used elsewhere in the program: it only adds functionality to types that already exist.
      5b1966d2
  8. 10 7月, 2017 1 次提交
    • B
      Get the list of file extensions from the Options · c29170e3
      Benjamin Sago 提交于
      The FileExtensions in the FileName is now a reference to the one in the original FileStyle, which gets put there in the options module.
      
      This allows the extensions to be derived from the user, somehow, in the future when that part’s done.
      c29170e3
  9. 08 7月, 2017 1 次提交
    • B
      Replace FileName::new with a factory · 0d613652
      Benjamin Sago 提交于
      The new FileStyles value will contain all the fields necessary to “style” a file’s name. Right now this is only the Classify field, but there can be more later. The benefit of this is that when we add more, we won’t need to update all the places where file names are displayed.
      0d613652
  10. 06 7月, 2017 7 次提交
    • B
      Add iso time style · 3251378e
      Benjamin Sago 提交于
      3251378e
    • B
      Add full-iso time style · f0eed9fd
      Benjamin Sago 提交于
      f0eed9fd
    • B
      Add long-iso style and --time-style option · 786e8f4d
      Benjamin Sago 提交于
      This has to do its own number formatting because *somebody* didn’t add “print the current month number” functionality to rust-datetime!
      786e8f4d
    • B
      Expect different time formats · 98b63705
      Benjamin Sago 提交于
      98b63705
    • B
      Separate TimeFormat from the Environment · ba335bb6
      Benjamin Sago 提交于
      By moving it outside of the Environment::load_all() constructor, it can be set to different values.
      ba335bb6
    • B
      Move Environment to a table’s Options · d93e168b
      Benjamin Sago 提交于
      This commit moves the Environment field from the Table to its Options, and properly gets rid of the name ‘columns’ from the last commit.
      
      Having it in the Options is important, because it means it can be generated from some command-line options. Also, it reduces the number of arguments that need to be passed to Table::new; there would have been 4 with the inclusion of the Environment, but by moving some of the code into the function, we can avoid this (and any further arguments).
      d93e168b
    • B
      Rename Columns to table::Options · 268b7d52
      Benjamin Sago 提交于
      The views have been renamed to be the Optionses of their module; now the options for the Table — Columns — has followed suit.
      
      This works out, because the table module depended on everything in the columns module. It opens the door for other only-table-specific things to be included.
      
      The casualty was that by making it non-Clone and non-PartialEq, a bunch of other #[derive]-d types had to have their derivions removed too.
      268b7d52
  11. 26 6月, 2017 3 次提交
    • B
      Inline this thing · 4be0a36d
      Benjamin Sago 提交于
      If a function returns one of several enum variants, but we’re only interested in one, then just return its contents and have it apply the Mode “wrapper” later.
      4be0a36d
    • B
      Remove filter and dir_action from Details · 65d94636
      Benjamin Sago 提交于
      These two fields were originally needed to determine how to recurse when using tree view.
      
      However, as there was no distinction between the “options parsed from the command-line” Details and the “values needed to render a table” Details, these had to be threaded through the options parser as a special-case to end up in the right struct.
      
      No more! Because there are separate structs for options and rendering, we can just add them in later.
      65d94636
    • B
      Create Render structs from views · 14144e2a
      Benjamin Sago 提交于
      Instead of having render methods on the types that are now called Options, create new Render structs (one per view) and execute them. This means that it’s easier to extract methods from them — some of them are pretty long.
      
      Also, remove the GridDetails struct, which got consumed by Mode (mostly)
      
      By introducing another indirection between the structs that command-line options get parsed into and the structs that get rendered, it should be easier to refactor that horrible function in view.rs.
      14144e2a
  12. 25 6月, 2017 6 次提交
    • B
      Separate colours from mode deduction · 66491cba
      Benjamin Sago 提交于
      Now that colours don’t depend on a previously-calculated “should we be using colours” boolean anymore, their entire deduce function can be done separately to the mode’s one.
      66491cba
    • B
      Fix bug where colours were incorrectly applied · 84b01f20
      Benjamin Sago 提交于
      exa assumed that the COLUMNS environment variable being present always meant that the output was to a terminal, so it should use colours. But because this variable can be overridden, colours were being incorrectly set!
      
      The ‘fix’ is to stop trying to be clever while only calculating the terminal width once, and instead just stick it in a lazy_static so it’s usable everywhere.
      84b01f20
    • B
      usize is Copy · b8bb148f
      Benjamin Sago 提交于
      b8bb148f
    • B
      Separate classify from the other two fields · 183ed9c1
      Benjamin Sago 提交于
      This makes the code messier, but it’s just a stepping-stone until colours gets separated too.
      183ed9c1
    • B
      Extract common classify · ed3d28f2
      Benjamin Sago 提交于
      ed3d28f2
    • B
      Move Colour and Classify to the View · aea0035f
      Benjamin Sago 提交于
      All four view types — lines, grid, details, and grid-details — held their own colours and classify flags.
      
      This didn’t make any sense for the grid-details view, which had to pick which one to use: the values were in there twice.
      
      It also gave the Table in the details view access to more information than it really should have had.
      
      Now, those two flags are returned separately from the view “mode”, which is the new term for one of those four things.
      aea0035f
  13. 24 6月, 2017 1 次提交
  14. 19 5月, 2017 1 次提交
  15. 07 5月, 2017 1 次提交
  16. 14 4月, 2017 1 次提交
  17. 01 4月, 2017 2 次提交
  18. 27 3月, 2017 1 次提交
  19. 31 10月, 2016 1 次提交