Commit Graph

1014 Commits

Author SHA1 Message Date
Ben S
74358c188a Properly handle errors when following a symlink
Fixes #123. The code assumes that every File that has its link_target() method called would first have been checked to make sure it’s actually a link first. Unfortunately it also assumed that the only thing that can go wrong while following a link is if the file wasn’t a link, meaning it crashes when given a link it doesn’t have permission to follow.

This makes the file_target() method able to return either a file or path for displaying, as before, but also an IO error for when things go wrong.
2016-10-29 20:27:23 +01:00
Ben S
ba366fc855 Add some symlink testcases 2016-10-29 19:58:34 +01:00
Ben S
dcc17b1d15 This lint flag started to cause all kinds of fuss 2016-10-29 19:52:21 +01:00
Ben S
36d9b6844e Add .tgz to the compressed file extensions
Fixes #129
2016-10-29 19:28:41 +01:00
Ben S
9589496aac Write some file-type integration tests 2016-10-29 19:28:20 +01:00
Ben S
a7e3456b0d Only engage the view when there are files to show
This changes the way that views are used to display the actual lists of files. It used to pass empty vectors to the view methods, which most of the time would not print anything because there are no files to list — except when there’s a header row which gets printed for no files.

By not calling the view method at all when there’s nothing to print, exa won’t ever print extra things in the view unless it needs to for a file.

This fixes #106 “Don’t print the header if the result set is empty”
2016-10-29 19:07:43 +01:00
Benjamin Sago
54067bf765 Replace the testcases script with a Vagrant VM
See the README section for more details. Basically, with this way, we can store a bunch of existing valid exa outputs, change a VM's environment to match our values, then check that exa still works by comparing outputs.
2016-10-07 19:31:03 +01:00
Benjamin Sago
d321434a47 Versions bump. Oh, and checksums! 2016-10-05 18:50:29 +01:00
Benjamin Sago
6d3e6b7cad Merge pull request #122 from quodlibetor/include-legal-args-in-error-messages
Add legal values to error messages
2016-10-05 16:48:55 +01:00
Benjamin Sago
a8b05fce83 Merge pull request #119 from gemmarx/use_stderr
Change to put error messages into stderr
2016-10-05 16:47:51 +01:00
Benjamin Sago
3f81300e21 Merge pull request #118 from gemmarx/ignore_brokenpipe
Change to ignore broken pipe error
2016-10-05 16:47:22 +01:00
Brandon W Maister
7e15e0dd49 Add legal values to error messages
Now when you do `--sort time` instead of saying "unknown option --sort
time" it will say "unknown options '--sort time' (choices: name...)"
with all legal options.

This also adds the legal values to the default help text.
2016-08-28 21:56:32 -04:00
Gemmarx
8d25719b6b Change to put error messages into stderr 2016-07-31 04:12:03 +09:00
Gemmarx
943ac87466 Change to ignore broken pipe error 2016-07-30 22:53:11 +09:00
Mattias Andrée
079c36b9f5 Rebulid when the source has been updated
You could use src/*.rs src/*/*.rs src/*/*/*.rs,
but explicit listing is prefered.

Ideally, you should be separate object files that
are rebuilt only when necessary, and then build
the final binary from those. But have not looked
at how to compile rust code so I don't know how
to do that, and since there are no header files
that is also probably suboptimal.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-05 00:56:37 +02:00
Mattias Andrée
f9208f9af8 Don't strip binaries
Let the package manager do it. You don't want to
force stripping, the symbols are useful for debugging.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 19:02:22 +02:00
Mattias Andrée
1099dad9d0 Add a missed DESTDIR
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:58:45 +02:00
Mattias Andrée
d894a3a475 Improve build rules
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:56:31 +02:00
Mattias Andrée
3d966e8184 Use = and not ?= for PREFIX
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:51:10 +02:00
Mattias Andrée
f30c75c224 Add clean rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:50:08 +02:00
Mattias Andrée
05451b7db8 Fix install rule and add uninstall rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:48:07 +02:00
Mattias Andrée
bbdcd52696 Do not look for rustc
You need cargo, not rustc, and cargo requires rustc,
so checking for rustc is incorrect. And the user will
know that she needs cargo when the command cannot be
find, so why look for it and add extra dependenices
just for that.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:40:04 +02:00
Mattias Andrée
54ed5f6756 Work around a bug in cargo
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:38:47 +02:00
Mattias Andrée
a77230a6e8 Proper install support
Use quotes to support spaces and such.
   Use -- to support dashes.

   And most important:

     Use DESTDIR to support installing into a staging directory.
     This is useful for packaging and verifying the install.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-07-04 13:18:13 +02:00
Benjamin Sago
6522337463 Merge pull request #114 from Lindenk/unix_types
Exa now recognizes pipes, devices, and sockets on unix systems
2016-07-02 14:52:58 +01:00
Linden Krouse
a9bb275250 Exa now recognizes pipes, devices, and sockets on unix systems. Fixes #112 2016-06-13 23:14:36 -04:00
Ben S
b8191670c7 Fix, and add tests for, slashes in link paths 2016-06-11 16:54:06 +01:00
Ben S
580ad0cfec Stop Travis from getting hung up on read 2016-06-11 14:12:38 +01:00
Ben S
921f3ca37c Make xattr tests optional for Travis 2016-06-11 14:06:43 +01:00
Ben S
5f01ff02fa Split tests into one file per test directory 2016-06-11 13:57:33 +01:00
Ben S
331d5ea724 Rename underscored lifetimes
See https://github.com/rust-lang/rfcs/pull/1177
2016-06-11 13:35:40 +01:00
Benjamin Sago
50c0c36b6b Update homepage link 2016-05-24 09:03:16 +01:00
Benjamin Sago
069908adb6 Merge pull request #111 from hoodie/master
Fix building without default features
2016-05-24 09:01:26 +01:00
Hendrik Sollich
c2d42e7d84 Fix building without default features 2016-05-03 00:03:22 +02:00
Benjamin Sago
299289d76f Fix the Travis build
The tests, as I so clearly wrote a comment to indicate, can only be run after the script to generate the testcases has been run...
2016-04-26 17:54:23 +01:00
Benjamin Sago
110a1c716b Convert exa into a library
This commit removes the 'main' function present in main.rs, renames it to exa.rs, and puts the 'main' function in its own binary. This, I think, makes it more clear how the program works and where the main entry point is.

Librarification also means that we can start testing as a whole. Two tests have been added that test everything, passing in raw command-line arguments then comparing against the binary coloured text that gets produced.

Casualties include having to specifically mark some code blocks in documentation as 'tests', as rustdoc kept on trying to execute my ANSI art.
2016-04-19 07:48:41 +01:00
Benjamin Sago
a02f37cb45 Change views to print to a Writer, not stdout
This will mean that we can test exa's output as a whole, without having to rely on process or IO or anything like that.
2016-04-18 18:39:32 +01:00
Benjamin Sago
476406f43b Remove unused argument 2016-04-17 21:01:30 +01:00
Benjamin Sago
78ff651326 Remove unnecessary .to_string()s from option tests 2016-04-17 20:56:06 +01:00
Benjamin Sago
e9e1161cec Split up the options module
The original options was becoming a bit unwieldy, and would have been even more so if I added the same amount of comments. So this commit splits it up.

There's no extra hiding going on here, or rearranging things within the module: (almost) everything now has to be marked 'pub' to let other sub-modules in the new options module to see it.
2016-04-17 20:38:37 +01:00
Benjamin Sago
b44ae1b56b Remove pointless OptionSet trait
The trait was only used internally to the options module, so it doesn't actually need to be exist or implemented on anything! We can just impl them directly on the types and have those methods be local to the module.
2016-04-16 22:25:24 +01:00
Benjamin Sago
45c93b1b63 Correct the list of crypto extensions
They were the same as the archive/compressed extensions, and I never noticed!
2016-04-16 22:17:12 +01:00
Benjamin Sago
fae0f3874e Create info module with business logic routines
Currently these routines number two: file type checking based on a file's name, and source file checking, also based on the file's name.
2016-04-16 22:05:50 +01:00
Benjamin Sago
b83844f384 Move a file's type out of its permissions field 2016-04-16 20:01:45 +01:00
Benjamin Sago
570fac0c18 Add comments to the new fields module 2016-04-16 19:56:44 +01:00
Benjamin Sago
efa372cb3b Source file rearrangements
This commit moves file, dir, and the feature modules into one parent 'fs' module. Now there are three main 'areas' of the code: main and options, the filesystem-touching code, and the output-displaying code.

It should be the case that nothing in 'output' touches 'std::fs'.
2016-04-16 18:59:25 +01:00
Benjamin Sago
b65043d6d9 Update raw libc types for Rust 1.8.0
Fixes #108. MetadataExt now returns direct numeric types rather than platform-specific ones, so we need to adjust the functions that use these to have the new types. I've just aliased the types to specific ones so the rest of the code remains the same (file.rs is the only place that uses this)

The RFC that changed this is here: https://github.com/rust-lang/rust/pull/31551
2016-04-16 17:06:26 +01:00
Benjamin Sago
9b87ef1da2 Print the parent path for passed-in files
This commit changes all the views to accommodate printing each path's prefix, if it has one.

Previously, each file was stripped of its ancestry, leaving only its file name to be displayed. So running "exa /usr/bin/*" would display only filenames, while running "ls /usr/bin/*" would display each file prefixed with "/usr/bin/". But running "ls /usr/bin/" -- without the glob -- would run ls on just the directory, printing out the file names with no prefix or anything.

This functionality turned out to be useful in quite a few situations: firstly, if the user passes in files from different directories, it would be hard to tell where they came from (especially if they have the same name, such as find | xargs). Secondly, this also applied when following symlinks, making it unclear exactly which file a symlink would be pointing to.

The reason that it did it this way beforehand was that I didn't think of these use-cases, rather than for any technical reason; this new method should not have any drawbacks save making the output slightly wider in a few cases. Compatibility with ls is also a big plus.

Fixes #104, and relates to #88 and #92.
2016-04-11 19:10:55 +01:00
Benjamin Sago
f35d28d1b8 Fix bug where the directory name was not printed 2016-04-11 07:48:23 +01:00
Benjamin Sago
c009a68ae5 Add Add impl and various tests for DisplayWidth 2016-04-05 18:45:35 +01:00