1. 29 6月, 2017 5 次提交
    • B
      Use the optional argument trick · 0aa33595
      Benjamin Sago 提交于
      0aa33595
    • B
      Match up fields with parameter names · 31148eda
      Benjamin Sago 提交于
      The arguments passed to File’s constructor were different from the field names used — these might as well both be the same.
      
      Also, move ext and filename to be File methods to save an import, and add tests.
      
      Also also, by passing a PathBuf in to the constructor directly, we can save one (possibly two) instance/s where we pass in a reference to something we were going to lose ownership of anyway, only to have it basically cloned.
      31148eda
    • B
      Always look up metadata · 30f74b08
      Benjamin Sago 提交于
      We can do this because the only File::new invocation that already has metadata is already in the file module, so it doesn’t need its own constructor.
      30f74b08
    • B
      Forbid --tree --all --all · 340bccbc
      Benjamin Sago 提交于
      There’s a problem with the tree view where it’ll still recurse through `.` and `..`. But if you were using tree view, would you even need to see them? They’d be in the tree already!
      340bccbc
    • B
      Override the names of . and .. · dd8bff08
      Benjamin Sago 提交于
      There was a problem when displaying . and .. in directory listings: their names would normalise to actual names! So instead of literally seeing `.`, you’d see the current directory’s name, inserted in sort order into the list of results. Obviously this is not what we want.
      
      In unrelated news, putting `.` and `..` into the list of paths read from a directory just takes up more heap space for something that’s basically constant.
      
      We can solve both these problems at once by moving the DotFilter to the files iterator in Dir, rather than at the Dir’s creation. Having the iterator know whether it should display `.` and `..` means it can emit those files first, and because it knows what those files really represent, it can override their file names to actually be those sequences of dots.
      
      This is not a perfect solution: the main casualty is that a File can now be constructed with a name, some metadata, both, or neither. This is currently handled with a bunch of Options, and returns IOResult even without doing any IO operations.
      
      But at least all the tests pass!
      dd8bff08
  2. 28 6月, 2017 1 次提交
  3. 27 6月, 2017 4 次提交
    • B
      Implement . and .. by inserting them maually · 20793ce7
      Benjamin Sago 提交于
      I originally thought that the entries . and .. were in *every* directory entry, and exa was already doing something to filter it out. And then... I could find no such code! Turns out, if we want those entries present, we have to insert them ourselves.
      
      This was harder than expected. Because the file filter doesn’t have access to the parent directory path, it can’t “filter” the files vector by inserting the files at the beginning.
      
      Instead, we do it at the iterator level. A directory can be scanned in three different ways depending on what sort of dotfiles, if any, are wanted. At this point, we already have access to the parent directory’s path, so we can just insert them manually. The enum got moved to the dir module because it’s used most there.
      20793ce7
    • B
      Allow passing in the --all option more than once · 39fd9059
      Benjamin Sago 提交于
      39fd9059
    • B
      Move the show-invisibles flag into a struct · 5ace1264
      Benjamin Sago 提交于
      5ace1264
    • B
      Merge branch 'common-view-fields' · c7f18873
      Benjamin Sago 提交于
      c7f18873
  4. 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
  5. 25 6月, 2017 7 次提交
    • 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
      Tests for disabling colours · 4e90b4d7
      Benjamin Sago 提交于
      4e90b4d7
    • 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
  6. 24 6月, 2017 11 次提交
  7. 16 6月, 2017 1 次提交
  8. 11 6月, 2017 1 次提交
  9. 30 5月, 2017 5 次提交
    • B
      Merge branch 'sticky-bits' · 110613bf
      Benjamin Sago 提交于
      This adds support for the setuid, setgid, and sticky bits like how ls does it: by replacing the user/group/execute bits with different flags depending on their presence. At least we do it with flair, and by flair, I mean purple.
      
      Fixes #142
      110613bf
    • B
      xtests for higher order bits · c4447e35
      Benjamin Sago 提交于
      Finally, re-do the permissions extended tests to include the setuid, setgid, and sticky bits, and rename the last two existing ones to match the others (files with the same names as their permissions).
      c4447e35
    • B
      Render higher permission bits · a2901c63
      Benjamin Sago 提交于
      Unlike the others, setuid/setgid/sticky get merged with user/group/other execute in the rendered Permissions cell. So there had to be a bit of code change done to make sure that none of the bits clashed.
      a2901c63
    • B
      Read setuid/setgid/sticky bits · f9f7ad22
      Benjamin Sago 提交于
      The problem here was that we were using `metadata.permissions().mode()`, which is capped at 0o777, rather than `metadata.mode()`, which exposes every bit. With this change, we can access the higher-order permission bits, and put them in the Permissions struct.
      f9f7ad22
    • B
      Merge branch 'split-details' · bd860b8f
      Benjamin Sago 提交于
      bd860b8f
  10. 22 5月, 2017 2 次提交