Commit Graph

126 Commits

Author SHA1 Message Date
Ben S
16fa37867d Versions bump (temporary, ignore this) 2016-02-10 20:28:24 +00:00
Ben S
7f480ab06b Improve system time zone detection 2016-02-10 19:02:20 +00:00
Ben S
75b2748ab1 Update packages to latest versions
- 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
2016-02-10 15:22:43 +00:00
Ben S
1f9b002d52 Versions bump 2016-01-22 02:11:34 +00:00
Benjamin Sago
c911b5f6e4 Replace Cells with growable TextCells
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
2015-12-17 08:25:20 +08:00
Benjamin Sago
c39a57294c Versions bump 2015-12-15 21:38:56 +00:00
Ben S
9218799e6e Upgrade versions to working ones 2015-11-18 18:32:40 +00:00
Ben S
e07992d08c Use lazy_static to cache datetime formats
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.
2015-11-15 19:26:58 +00:00
Ben S
cc04d0452f Pin versions to those we know work 2015-11-04 17:01:05 +00:00
Ben S
63bd929eb5 Upgrade to latest ansi_term
Changes to the way ANSIStrings work mean we need to dereference the strings before putting them in an ANSIString. There's more that can be done here, but this gets it to compile for now.
2015-11-03 11:17:44 +00:00
Ben S
1bebab78d0 Upgrade Rust version necessary 2015-10-30 10:40:56 +00:00
Ben S
8f4a2087e6 Version v0.4.0 2015-10-18 20:34:46 +01:00
Ben S
878d54111d Pin to git2-rs version 0.3
This should prove more stable than relying on a Git version.
2015-10-02 00:56:39 +01:00
Ben S
41fb02a02d Upgrade to latest version of datetime crate
- VariableOffset -> TimeZone::VariableOffset
2015-09-21 00:15:07 +01:00
Benjamin Sago
12ab6bebc6 Versions bump (git2, winapi) 2015-09-15 20:04:21 +01:00
Ben S
d1e682b0c1 Remove pad crate and unnecessary qualifications 2015-09-04 11:20:13 +01:00
Ben S
d089fcc1d8 Update rust-tz, amongst others 2015-09-02 23:23:23 +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
e523520b56 Versions bump 2015-08-25 18:25:48 +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
Kevin K
decd0c21ae updates libgit2 to build on latest nightly 2015-07-09 09:08:13 -04:00
Ben S
fe0d433e65 Require functionality from new term_grid 2015-06-29 14:24:39 +01:00
Ben S
766279b803 Versions bump 2015-06-28 06:17:00 +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
Ben S
4c61361bfb Version bump! 2015-06-05 04:00:38 +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
334258c18d Versions bump 2015-05-29 11:33:27 +01:00
Ben S
2594690aff Start using the libc crate from crates.io 2015-05-16 13:17:50 +01:00
Ben S
36116a1420 Add colours module, and disable them sometimes
Colours are now disabled when output is not to a terminal. Fixes #53!

This required some internal restructuring - colours are now in their own object that gets passed around everywhere it's needed.
2015-05-09 23:57:18 +01:00
Ben S
a460f257d7 Friendly neighbourhood versions bump 2015-05-06 21:46:21 +01:00
Ben S
41aadaeab4 Re-implement no-longer-missing metadata fields 2015-05-03 12:46:05 +01:00
Ben S
c3915576c1 Versions bump 2015-05-03 11:47:25 +01:00
Ben S
d7d11f77f3 Use unicode_width crate 2015-04-23 13:46:37 +01:00
Ben S
adbaa51cb9 Use new io + path + fs libraries (LOTS OF CHANGES)
Exa now uses the new IO, Path, and Filesystem libraries that have been out for a while now.

Unfortunately, the new libraries don't *entirely* cover the range of the old libraries just yet: in particular, to become more cross-platform, the data in `UnstableFileStat` isn't available in the Unix `MetadataExt` yet. Much of this is contained in rust-lang/rfcs#1044 (which is due to be implemented in rust-lang/rust#14711), but it's not *entirely* there yet.

As such, this commits a serious loss of functionality: no symlink viewing, no hard links or blocks, or users or groups. Also, some of the code could now be optimised. I just wanted to commit this to sort out most of the 'teething problems' of having a different path system in advance.

Here's an example problem that took ages to fix for you, just because you read this far: when I first got exa to compile, it worked mostly fine, except calling `exa` by itself didn't list the current directory. I traced where the command-line options were being generated, to where files and directories were sorted, to where the threads were spawned... and the problem turned out to be that it was using the full path as the file name, rather than just the last component, and these paths happened to begin with `.`, so it thought they were dotfiles.
2015-04-23 13:00:34 +01:00
Ben S
9758e96755 Bump versions yet again 2015-04-09 11:32:30 +01:00
Benjamin Sago
4d2d2385c1 One last version bump for the road... 2015-04-04 00:27:05 +02:00
Benjamin Sago
f885568145 Upgrade to latest Rust
Still missing a few Beta features, but it compiles!

- Copy requires Clone
- current_dir returns a Path now
- num_cpus moved to a crate
2015-04-04 00:14:56 +02:00
Ben S
697e1e66e4 Versions bump for latest Rust
- Changes to users crate
2015-03-26 00:35:39 +00:00
Ben S
9c2858e447 Upgrade to latest Rust
- old_path::Path isn't imported by default anymore
- range -> ..
2015-03-22 19:46:45 +00:00
Ben S
e6fa6c5b92 Versions bump 2015-03-22 12:05:29 +00:00
Ben S
640949934e Versions bump 2015-03-17 12:33:18 +00:00
Ben S
714e22f7a5 Versions bump 2015-03-12 03:13:15 +00:00
Ben S
99f9a75a24 Versions bump 2015-03-07 23:01:57 +00:00
Ben S
67f60e614b Add --version command (and bump version) 2015-03-02 14:54:38 +00:00
Ben S
6b3d812af5 Use development version of libgit2-rs
This stops the openssl-sys version clash preventing exa from compiling.
2015-03-02 01:58:39 +00:00
Michael Faille
2701c20a36 FIX bitflags depedency 2015-02-21 17:59:38 -05:00
Ben S
e15f72f049 Versions bump
This compiles, but with manymany warnings.
2015-02-21 13:51:44 +00:00
Ben S
900081e9c1 Versions bump 2015-02-17 07:50:52 +00:00
Ben S
d180a5f5e4 Use ansi_term's awesome new continuation colours 2015-02-13 21:24:10 +00:00
Ben S
ec51867a53 Upgrade to latest Rust
- Update package versions
- locale::default -> locale::english
- Argument handling changes
2015-02-12 22:33:01 +00:00
Ben S
2906b8676a Translate month names into the user's locale
This has been mostly done with changes in the datetime crate's suddenly
supporting locales.

It's still important that the user's locale is touched only once and
cached from that point on, so a struct in output::details has been made
public, along with that module. This will change later as that object
gains more and more uses thoughout the codes.
2015-02-10 18:14:56 +00:00
Ben S
21ac16f808 Format file size in bytes with the user's locale
Use the `locale` crate as a dependency to read in the set
thousands-separator character, and pass this to the file size column,
which uses it to add the separators in.

en_GB uses ","
fr_FR uses "" and just displays the numbers in one go.
2015-02-10 16:08:10 +00:00
Ben S
9dbca5f12a Use specified version of datetime
This prevents crates.io from doing weird things from a circular depedency, which is probably my fault.
2015-02-09 23:51:26 +00:00
Ben S
924416d8fb Actually use the public datetime crate... 2015-02-09 19:40:49 +00:00
Ben S
0d25a90ef1 Initial work on date/time columns for files
Using the datetime crate, add an extra column to the --long view that
prints out the modified, accessed, or created timestamp for each file.
Also, let the user pick which one they want to see based on the --time
command-line option.
2015-02-09 16:33:27 +00:00
Ben S
3289b82e2f Bump versions! 2015-02-06 13:59:16 +00:00
Ben S
8f36dbbc6f Start using the new getopts interface 2015-02-04 14:51:55 +00:00
Ben S
0f1843f5e7 Use latest, working version of ansi_term crate 2015-02-04 14:51:25 +00:00
Ben S
815ec8a4ab Update to most recent versions of libraries 2015-02-04 01:34:21 +00:00
Ben S
6d4b30d531 Code changes in preparation for recursion 2015-01-31 16:10:40 +00:00
Ben S
947087567c Upgrade to latest Rust
- Rename std::io to std::old_io
2015-01-28 16:55:34 +00:00
Ben S
90d4684de4 Preliminary Git support!
This is something that I've long wanted to add. It uses libgit2 as an optional dependency.
2015-01-27 15:01:17 +00:00
Benjamin Sago
1c5409e253 Upgrade to Rust alpha
- uint -> usize
- getopts Cargo library
- replace feature gates with unstable APIs
2015-01-12 01:31:24 +01:00
Benjamin Sago
2784baea0a Switch to Crates dependencies format 2015-01-12 01:20:28 +01:00
Ben S
ee23d6b33a Upgrade to working library versions 2015-01-06 23:39:24 +00:00
Ben S
d400231de5 Upgrade to latest Rust
Also, remove dependency on the Regex library by replacing the one place it was used with standard code that should hopefully be faster anyway.
2015-01-05 14:41:43 +00:00
Ben S
ba36d4f7f0 Library and Rust upgrades 2015-01-04 13:56:07 +00:00
Ben S
e3a8342173 Upgrade code and libraries to latest Rust
std::str changes, and the way macros are expanded.
2014-12-24 04:31:59 +00:00
Ben S
24628f97be Use number_prefix crate for number prefixes 2014-12-18 07:00:31 +00:00
Ben S
09845ccf20 Upgrade to latest version of ansi_term 2014-12-12 15:15:35 +00:00
Ben S
66339e7a15 Miscellaneous little optimisations
- Prefer iter over into_iter where appropriate
- Cut down on cloning
2014-12-12 14:06:48 +00:00
Ben S
65f124fe39 Use the natord library instead of our own sorter
I'm serious, the more functionality I can use external crates for, the better.
2014-12-12 11:26:18 +00:00
Ben S
6770ac5475 Replare Unix module with users crate
Feels good turning all that code into a dependency!
2014-12-12 11:17:55 +00:00
Ben S
05dd644c92 Upgrade to latest ansi_term
Yeah, I broke my own code again.
2014-11-26 07:36:09 +00:00