Commit Graph

84 Commits

Author SHA1 Message Date
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
2ffa64cff6 Move all optional features into features module
This module provides feature-specific implementations, and also dummy implementations for when they aren't supported by the system or OS.

Doing it this way limits all the #[cfg(feature)] annotations, as we can now just include the module or not.
2015-03-26 00:37:12 +00:00
Ben S
d71140079b Missed a feature flag... 2015-03-22 19:54:12 +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
Eirik Schwenke
8b2a19046e The path_filename function/method isn't declared public. If the declaration is changed, rustc complains about a conflict. This seems to be the minimal change needed for tests to run. 2015-03-22 08:50:15 +01:00
Ben S
027ca60d90 current_dir -> getcwd
current_dir returns a new PathBuf, but getcwd returns an old Path. One day I'll have to upgrade to the new Path library. One day.

Fixes #41.
2015-03-01 13:50:15 +00:00
Ben S
ff1f6d0087 Add --group-directories-first option
Closes #27.
2015-02-26 14:05:26 +00:00
Jonny Gilchrist
96cab9cd05 Fix a missing '/' in symlink targets
In cases where symlink targets were more than a single directory down,
exa did not print the '/' targets when separating directories, resulting
in the following output:

    symlink => dirAdirBdirC/file

Instead of

    symlink => dirA/dirB/dirC/file

By adding a '/' character after each component of the filename, this
error is fixed.
2015-02-24 03:28:34 +00:00
Ben S
ce23c63d75 Merge branch 'nwin:add-xattr-linux'
Conflicts:
	src/file.rs
2015-02-23 14:52:07 +00:00
Ben S
38a785426b Fix overflowing UIDs and GIDs
Fixes #26.
2015-02-23 13:37:59 +00:00
Ben S
1da1142a7e Fix panic when previewing symlink to ., .., or /
The old implementation blindly assumed that a symlink target would have a directory compoment, which the current directory, parent directory, and root directory technically don't have.

Fixes #20.
2015-02-23 11:32:35 +00:00
Ben S
e21dc9af2a Merge pull request #21 from coyotebush/git-paths
Improve matching of Git status entries to files
2015-02-23 00:46:36 +00:00
Ben S
ae39d0f8a7 Merge pull request #19 from Stebalien/replace-as_slice
Get rid of explicit `as_slice()` calls
2015-02-22 23:50:38 +00:00
nwin
beaf8789ce true -> false 2015-02-23 00:08:44 +01:00
Corey Ford
6e19563879 Improve matching of Git status entries to files
The challenge is that the paths returned from libgit2's status listing
are from the perspective of the Git repository and thus effectively
relative to the working tree root, while the other paths we're
manipulating are (potentially) relative to our current working
directory. So, if those two aren't identical (if running from outside
the working tree, or from a subdirectory), the paths won't match up.

A reasonably reliable way around this is to resolve both types of paths
to absolute paths before comparing them. This fixes #15 at a basic
level, anyway.

What still doesn't work: referring to the working tree or one of its
descendants via a symlink. For that, we'd probably need to fully resolve
symlinks in the file path.

(The unwrap_or()'s are messy and will probably just result in missing
status information, but then, what information could you hope to get
without having both a current working directory and a Git working tree?)
2015-02-22 14:44:54 -08:00
nwin
0082563e47 Using the same alignment as ls. 2015-02-22 18:50:52 +01:00
nwin
8ac16fad8a Using convenience method and using extended clusters as recommended. 2015-02-22 18:36:11 +01:00
Steven Allen
2b5406842f Get rid of explicit as_slice() calls. 2015-02-22 12:11:33 -05:00
nwin
3d587c4533 Rename attr to xattr 2015-02-22 13:55:13 +01:00
nwin
48b6123165 Implement display of extended attributes 2015-02-22 13:26:52 +01:00
Ben S
b2ed264ba4 Upgrade to latest Rust
- Feature flags changes (old_io, old_path)
- Slice syntax changes ([] -> [..])
2015-02-21 13:54:35 +00:00
Ben S
03a05b7020 Detab 2015-02-13 21:24:29 +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
e39a20a5d4 Use locale-defined decimal separator
Also, fix the broken tests by just using the default locale at test
time.
2015-02-10 16:42:25 +00:00
Ben S
84b18e5521 Add thousands seps to links and blocks columns 2015-02-10 16:21:19 +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
8b520edf3d Only display the year if it's last year
Otherwise, just display the hour and minute.
2015-02-09 18:14:05 +00:00
Ben S
bc7492e7e6 Add hour and minute to timestamps 2015-02-09 17:55:55 +00:00
Ben S
bf815afa8e Use short month names to make them line up 2015-02-09 17:37:02 +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
42ae7b3d33 Refactor the code after tree view changes
- Turn the views and main program loop into structs, rather than just as one gigantic function
- Separate views into their own files

The addition of the git column and the tree view meant that a lot of functions now just took extra arguments that didn't seem to fit. For example, it didn't really work to have only one 'view' method that printed out everything, as the different view options now all take different parameters.
2015-02-05 14:39:56 +00:00
Ben S
1bced1423b Fix tests from tree view fallout 2015-02-04 01:12:08 +00:00
Ben S
827a1e11fd Make filename not a column
FileName was always a special-cased column, as it was assumed to be the last column in the output. Now, it's explicitly marked as such. This allows the hash marks to be placed before the filename, rather than at the start of the line.
2015-02-03 13:48:39 +00:00
Ben S
5099b3f119 Initial tree implementation
There's still a lot to do, but this is actually *something*. The tree hierarchy is displayed using hashes at the start of a line. I want to have it just before the filename, but this will need some changes to the way that columns are handled.
2015-02-03 13:27:23 +00:00
Ben S
10096d1043 Prevent crash for filenames with no components
Now there are no more unwrap()s!
2015-01-31 17:18:53 +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
f794f5eda6 Implement Git status for directories 2015-01-28 10:43:19 +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
Ben S
e835fe8fe3 Make all fields of Dir private 2015-01-26 17:26:11 +00:00
Ben S
da9d1f77d9 Cache the lowercased extension
Extensions aren't ever displayed in lowercase, just compared case-insensitively, so this makes sense.
2015-01-26 01:16:19 +00:00
Benjamin Sago
628d90fe44 Test extension extraction 2015-01-25 13:47:07 +00:00
Benjamin Sago
ef4428fab1 Test highlighting of groups and group names 2015-01-25 13:43:44 +00:00
Benjamin Sago
191c0e5b90 Test highlighting of usernames 2015-01-25 13:04:15 +00:00
Benjamin Sago
c53a0156e6 Extract symlink stuff into its own method 2015-01-24 17:34:33 +00:00
Benjamin Sago
449592c150 Do column width calculations ourselves (speedup)
Instead of stripping the ANSI formatting characters from our strings, work out the length without them and use that. This is per-column, but most of them are simple (just the same number of characters in the non-coloured string).

Sometimes, this is really simple: for example, trwxrwxrwx permissions strings are always going to be ten characters long, and the strings that get returned are chock full of ANSI escape codes.

This should have a small benefit on performance.
2015-01-24 17:26:26 +00:00
Ben S
2ba0b3bd5f Convert docs to standard format 2015-01-24 12:38:05 +00:00
Ben S
0e473bf37b Upgrade to latest Rust, and move options code 2015-01-23 19:27:06 +00:00