Commit Graph

303 Commits

Author SHA1 Message Date
Ben S
f7131a740b Fix warning when building on 64-bit systems
This warning was 'caused' by the previous commit (but it's small and easy to fix, so don't worry)
2015-10-02 00:56:09 +01:00
rhysd
3dbc441c78 Fix integer length error on 32bit environment
this commit fixes below type mismatch error:

```
src/output/details.rs:585:49: 585:60 error: mismatched types:
 expected `i64`,
    found `i32`
(expected i64,
    found i32) [E0308]
src/output/details.rs:585         let date = self.tz.at(LocalDateTime::at(timestamp.0));
                                                                          ^~~~~~~~~~~
src/output/details.rs:585:49: 585:60 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error
Could not compile `exa`.
```
2015-09-28 11:42:52 +09:00
Ben S
41fb02a02d Upgrade to latest version of datetime crate
- VariableOffset -> TimeZone::VariableOffset
2015-09-21 00:15:07 +01:00
Benjamin Sago
3d3acc2e93 Dismiss some compile-time warnings
The `unused_results` lint was complaining that the results of inserting into a `MockUsers` object weren't being inspected. These are mock users, so all that would be returned is `None` to indicate that they weren't already in the table -- they're fine to ignore! So, suppress the warnings for those two testing modules.
2015-09-15 20:05:27 +01:00
Michael Neumann
6317417a98 This makes exa work on other platforms than linux and macosx. 2015-09-14 01:37:52 +02:00
Benjamin Sago
6cf9274828 Do not attempt to print nothing
This fixes a bug where an extra header line was printed when in --long --grid mode.
2015-09-05 17:40:02 +01:00
Ben S
65967355a8 Make sure we check the ioctl term size result 2015-09-04 11:30:46 +01:00
Ben S
d1e682b0c1 Remove pad crate and unnecessary qualifications 2015-09-04 11:20:13 +01:00
Ben S
f526d24911 Remove trivial cast 2015-09-04 11:17:59 +01:00
Ben S
10fecbd7f6 Details view comments and tidy-ups 2015-09-03 18:48:53 +01:00
Ben S
a14f1d82f0 It's hardly worth giving Exa its own constructor 2015-09-03 13:38:18 +01:00
Ben S
83f05ffb3c Remove redundant attribute field 2015-09-03 13:38:06 +01:00
Ben S
4424a6df96 Rename readdir -> read_dir 2015-09-03 10:51:59 +01:00
Ben S
4e49b91d23 Parallelise the details view!
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 :)
2015-09-02 23:19:10 +01:00
Ben S
5f48bfd8b4 Propagate errors that occur during readdir
Fixes #71 - the I/O error should now be displayed as an error, rather than as a panic.

Also, fix some comments.
2015-08-26 12:19:23 +01:00
Ben S
5e1ff9cdcd Restore xattrs to their long view column
Had to thread the value in at display-time to get it to only query the attributes once!

This isn't the nicest way to do it, but this *is* a bit of an edge-case (it's the only thing where a column depends on something that gets calculated later)
2015-08-26 12:00:31 +01:00
Ben S
31dec1d1ba Use the correct ASCII for rows with errors/attrs
This prints three separate groups of child nodes: firstly the xattrs, then the errors, then any file children. It's done this way to only check for the 'last' child when necessary.
2015-08-26 11:36:10 +01:00
Ben S
b5edee53bd Scan for nested files on-demand, not all the time
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.
2015-08-26 09:35:11 +01:00
Ben S
69b22a0d66 Print xattrs in tree view like we do errors
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!
2015-08-26 09:03:43 +01:00
Ben S
a250f21282 Coalesce platform-specific xattr modules
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.
2015-08-25 18:29:23 +01:00
Ben S
2741c19e93 Fix bug where errors' tree parts ended early
Have to collect the results into a Vec in order to make sure we only do the ending part for the last one.
2015-08-25 15:27:24 +01:00
Ben S
2a9b6fe930 Display errors inline in the tree
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.
2015-08-25 15:04:15 +01:00
Ben S
7deb08644a Comment corrections 2015-08-25 11:50:07 +01:00
Ben S
ec0539d314 Make the cells optional for display Rows.
This will be used to not provide any information for the rows that will have no data (attributes, errors).
2015-08-25 11:45:27 +01:00
Ben S
5d0bd37168 Make Dir return an Iterator of files, not Vec
This is part of work to make the flow of files more iterator-able, rather than going in and out of vectors. Here, a Dir returns an iterator of files, rather than a pre-filled vector.

For now, this removes the ability for error messages to be displayed. Will be added in later though!
2015-08-25 11:27:08 +01:00
Ben S
d547c3f5d7 Fix bug where Git repos were always queried
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.
2015-08-03 18:44:33 +01:00
Ben S
e1f4ea9215 Allow --tree without --long
This kind of abuses the details view by giving it no columns when the Columns value is None (it's now Optional).
2015-08-03 13:54:25 +01:00
Ben S
ebbac61c74 Slim down symlink arrow
Fixes #74. There's one argument for changing the arrow, and none against!
2015-08-03 10:22:24 +01:00
Ben S
21ee2fbb30 Use new slice_splits functions
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.
2015-08-02 15:28:40 +01:00
Ben S
d710151ea9 Updates for term-grid
The separator_width field in the term_grid crate was replaced with a filling field.
2015-07-15 21:16:08 +01:00
Ben S
56895ab84f Extract some methods 2015-06-29 14:47:07 +01:00
Ben S
2bc7fde715 Allow using --across with --long --grid 2015-06-29 13:13:23 +01:00
Ben S
6d6e8b78f0 Fix bug where unfilled displays were being checked 2015-06-28 21:27:18 +01:00
Ben S
26e3abc6b1 Re-add missing failing option combinations 2015-06-28 20:41:38 +01:00
Ben S
922cd2a188 Cache the rendered cells
Previously, each time it tried to render a table (to check its width), it both re-queried the filesystem and re-formatted the values into coloured strings.

These values are now calculated only once before the table is drawn, and are used repeatedly throughout.

Although it looks as though there's more `clone()`ing going on than before, it used to be recalculating things and storing them as vectors anyway, so the memory would still be used in any case.
2015-06-28 19:57:13 +01:00
Ben S
89526964c9 Go top-to-bottom, not left-to-right 2015-06-28 19:11:39 +01:00
Ben S
08f3514d68 Adapt the long grid view to the console width 2015-06-28 16:25:59 +01:00
Ben S
ccdf9ff4a6 Add --grid --long option
This commit adds --grid, which, when used with --long, will split the details into multiple columns. Currently this is just 2 columns, but in the future it will be based on the width of the terminal.

In order to do this, I had to do two things:

1. Add a `links` parameter to the filename function, which disables the printing of the arrow and link target in the details view. When this is active, the columns get way too large, and it becomes not worth it.
2. Change the `print_table` function from actually printing the table to stdout to returning a list of `Cells` based on the table. This list then gets its width measured to calculate the width of the resulting table.
2015-06-28 13:21:21 +01:00
Ben S
8d6f62840a Use term_grid crate for grid formatting
Fixes #39!
2015-06-23 10:54:57 +01:00
Ben S
b235b64060 The feature flags wheel keeps on turning... 2015-06-21 12:52:53 +01:00
Benjamin Sago
488c7dc9c4 Remove a few feature flags 2015-06-17 18:31:53 +01:00
Michael Neumann
96018841f6 Fix terminal window size for DragonFly 2015-06-17 02:13:53 +02:00
Michael Neumann
a0105b951d Move dummy xattr Attribute implementation into its own module. 2015-06-17 01:52:06 +02:00
Michael Neumann
6155252ac8 metadata.as_raw() is gone in nightly 2015-06-17 01:49:29 +02:00
Ben S
b57e82e771 Typo fix 2015-06-08 21:52:46 +01:00
Ben S
2d8a9b49be Various unimportant style changes 2015-06-08 21:33:39 +01:00
Ben S
ea3a57eb97 Start using threadpool crate 2015-06-05 03:04:56 +01:00
Ben S
cc1d6aa5f1 Display dates with the host's timezone
Fixes #54 using the datetime crate's spiffy new time zone ability.
2015-06-04 15:15:39 +01:00
Ben S
90c77ff3b4 Fix failing test code 2015-05-29 20:39:45 +01:00
Ben S
4d2d8686c8 Use new ansi-term
- Plain -> Style::default()
2015-05-29 11:34:57 +01:00