Commit Graph

490 Commits

Author SHA1 Message Date
Ben S
43e3f742ca Comply with latest rust-ansi-term 2014-07-02 21:47:43 +01:00
Ben S
e1693cd769 Third time lucky? 2014-07-01 20:39:41 +01:00
Ben S
c6a8fadac0 Second try at Travis+Cargo fixes 2014-07-01 20:34:35 +01:00
Ben S
7aec8631ab Get Cargo working on Travis 2014-07-01 19:11:35 +01:00
Ben S
d2647df0ca Move some stuff out to rust-ansi-term crate 2014-07-01 19:00:36 +01:00
Ben S
eecfd88363 Simplify alignment code 2014-06-30 09:59:54 +01:00
Ben S
178e24552d Move comment 2014-06-30 02:06:07 +01:00
Ben S
44628ba6e2 Standardise on a grey 2014-06-30 02:04:36 +01:00
Ben S
0a1d3f56ec Add guard to get_source_files 2014-06-30 02:00:05 +01:00
Ben S
c494c0cd22 Don't scan the filename string twice 2014-06-30 01:51:11 +01:00
Ben S
f0fc7e992a Make pointers const (to comply with nightly Rust) 2014-06-29 22:28:52 +01:00
Ben S
df65886d6d Properly handle invalid UTF-8 filenames 2014-06-29 21:02:14 +01:00
Ben S
85e557a744 Highlight common build files 2014-06-28 17:56:57 +01:00
Ben S
2fa954be20 Fix Travis integration 2014-06-28 17:28:00 +01:00
Ben S
a8465fed45 Move to Cargo 2014-06-28 17:24:20 +01:00
Ben S
ee8c146ced Simplify string padding 2014-06-28 15:40:12 +01:00
Ben S
745bcce02a Replace messy line with calls to get 2014-06-28 15:17:57 +01:00
Ben S
e9ad6d79ca Add options to readme 2014-06-28 12:20:50 +01:00
Ben S
cc1da7490a Add .travis.yml 2014-06-28 12:05:01 +01:00
Ben S
45be82e257 Add precision to file sizes 2014-06-28 11:32:29 +01:00
Ben S
a8d73d1cd9 Add colour tests
And fix bugs found by these tests...
2014-06-27 22:31:23 +01:00
Ben S
03bf728a1e Merge branch 'master' of github.com:ogham/exa
Conflicts:
	unix.rs
2014-06-27 20:12:40 +01:00
Ben S
727822308e Refactor user/group code to be less indented 2014-06-27 19:51:04 +01:00
Ben S
68cd6d5da1 Fix bug about nonexistent groups in groups column 2014-06-27 12:46:08 +01:00
Ben S
b337f9174d Highlight groups the user is a member of
First non-trivial change for a while... because this involves reading from the OS, we should cache as much as we can in memory. So, group membership checking is done immediately after reading a group name, as the group structure has already been populated.
2014-06-26 23:26:27 +01:00
Ben S
baf9f9572f Highlight link number for files with multiple links
Curiously enough, this turned out to be helpful today... Git can't
traverse symlinks, so I had to use hard links instead, and then I had to
work out which files had more than one link at a glance. If I hadn't
already had most of exa written, I'd be stuck using find!
2014-06-26 12:46:40 +01:00
Ben S
55280a5308 Add a simple Makefile 2014-06-23 18:30:08 +01:00
Ben S
038143682c Add header row with -h option 2014-06-23 18:26:35 +01:00
Ben S
48284e0aef Add number of blocks column 2014-06-22 08:09:16 +01:00
Ben S
19e0f9b70d Add inode number column 2014-06-22 07:44:00 +01:00
Ben S
fc8f8d6c6a Add number of hard links column
This is behaviour cribbed from ls. Even though I've never personally used it, I'm sure someone has a use for it.
2014-06-22 07:40:40 +01:00
Ben S
8839cf4ca5 Show file colours for symlink targets
This requires the dir field to store a reference to the path that
created it, so that path can be used to join onto the filename so it can
be properly statted.
2014-06-21 19:39:27 +01:00
Ben S
eff87440fa Do similar for block devices and named pipes
There doesn't seem to be an io::FileType entry for character special
devices or sockets, so these fall under the io::UnknownType entry. Which
also gets highlighted in yellow, for precisely that reason.
2014-06-21 18:27:26 +01:00
Ben S
a542fdc9f9 Highlight symlinks in cyan 2014-06-21 18:17:24 +01:00
Ben S
49d3caf0e9 Print directory names when given more than one 2014-06-21 18:12:29 +01:00
Ben S
b5a1b24bda Cache user and group names
I checked strace and it was reading /etc/passwd every time it needed to
look up a user or group. Now it only does it once per.
2014-06-21 17:50:37 +01:00
Ben S
5c0d2d07d0 Show files on the end of symlinks 2014-06-21 10:11:50 +01:00
Ben S
2adc9b8dc9 Actually display is better used here 2014-06-20 21:40:31 +01:00
Ben S
9187ded71b Tidy up unused imports 2014-06-20 21:08:02 +01:00
Ben S
92b45e6908 Handle errors instead of fail!()ing
Dir::readdir and File::from path now both return IoResults, rather than just calling fail! and exiting. This allows the program to continue after an error.
2014-06-20 21:07:53 +01:00
Ben S
355ca51617 Stop adding spaces to the end of each line
This left-aligns the final column, but the final column is the file name, so that's okay.
2014-06-20 19:43:15 +01:00
Ben S
8b68d699db Fix bug in sort where numbers could get too long
Fall back to strings. Also, add some unit tests.
2014-06-18 17:26:28 +01:00
Ben S
2bb563d448 Upgrade to latest Rust nightly
- s/syntax/phase
- no more boxed array syntax
- getopts fail implements Show
- option#expect now requires &str
2014-06-18 13:39:55 +01:00
Ben S
98b759d65d Merge branch 'refs/heads/file-types' 2014-06-18 08:27:15 +01:00
Ben S
f6b6d4d6a7 Merge the two source-file methods 2014-06-18 08:27:06 +01:00
Ben S
75e8d829f3 Make file types a trait 2014-06-17 22:17:22 +01:00
Ben S
03ec414dfb Move file-type detection to its own module
I'd much rather have this separate, as it has the definite potential to
balloon up to a huge size and end up making the other parts of the file
module hard to read. But on the other hand, it meant making a few more
methods public on file... readability over cleanliness, I guess.
2014-06-17 09:35:40 +01:00
Ben S
a5e404da55 Cache readdir results in a Dir object
This new object is then passed down to the File, so it can see what files are around it. This means it doesn't need to re-query the filesystem several times per file, instead using the in-memory copy.

Also, switch to using the built-in Path#with_extension method.
2014-06-17 00:27:05 +01:00
Ben S
78771a3a3e Add a bunch more file types
And an extra level of compiled files that don't get highlighted when their source files aren't present. I don't really like having two functions that do (almost) the same thing, but I have to due to the way colouring is done.
2014-06-16 23:34:22 +01:00
Ben S
cce20d5953 Highlight compiled files if their source is present
Compiled files with a source present (such as code.o when code.c is present) are now classified as temporary files. If the source isn't present, they're highlighted in a kind of drab colour (using the new 255-colour ability, yay!)

The code does do exists() checks on the filesystem when it could be possible to compare the files to the list of files we got from the call to readdir(), but it doesn't.
2014-06-16 21:20:09 +01:00