Commit Graph

1343 Commits

Author SHA1 Message Date
Benjamin Sago
86de17b788 Help text changes
This changes the --help text, and gets rid of the special behaviour for --help --long, which I thought was a really good idea at the time, but now I just think it's inconsistent and unexpected behaviour. --help should return the same help, no matter what other arguments you have typed.

Other things:
• Put --help and --version in a section
• Capitalisation consistency
• Alignment
• Move the --octal-permissions line up a bit
• Simplify the printing implementation (HelpString is now a unit struct)

This _finally_ makes all the extended tests pass.
2020-10-16 23:53:42 +01:00
Benjamin Sago
91f1541e85 Make the Vagrant environment creation nicer
Now, instead of reams of unreadable command output, we get a nice set of stages:

[ 0/13] Deleting existing test cases directory
[ 1/13] Creating file size testcases
[ 2/13] Creating file name extension testcases
[ 3/13] Creating file names testcases
[ 4/13] Creating special file kind testcases
[ 5/13] Creating symlink testcases
[ 6/13] Creating user and group testcases
[ 7/13] Creating file permission testcases
[ 8/13] Creating date and time testcases
[ 9/13] Creating extended attribute testcases
[10/13] Creating Git testcases (1/3)
[11/13] Creating Git testcases (2/3)
[12/13] Creating Git testcases (3/3)
[13/13] Creating hidden and dot file testcases

The scripts have been moved out of the Vagrantfile because it was getting long and they're more readable this way.
2020-10-16 23:41:25 +01:00
Benjamin Sago
f7a3df6229
Merge pull request #750 from Finermeerkat137/pullreq2
Add PKGBUILD, *.heic, and *.heif to their respective filetypes
2020-10-15 22:40:11 +01:00
Sudhip Nashi
42b9a5802e
Add extra coloring 2020-10-15 15:38:38 -05:00
Benjamin Sago
5dfa5769c3 Slightly better install instructions
• Mention using 'just --tasks'
• Mention using the '--release' flag
• Mention how to build and install the man pages
2020-10-14 22:20:37 +01:00
Benjamin Sago
6ef7dba160 README REVAMP
• Make the README look a bit nicer, with centered text and links and badges and stuff like that. Everyone knows that software is better if it has badges in its readme
• Fix bug where the options list was unnaturally spaced
• More OS installation commands
• A couple of rephrasings
2020-10-13 21:52:08 +01:00
Benjamin Sago
31a2eba2fe Travis changes
• Modernise the Travis incantations, which have become old and faded since they were first written
• Specify a MSRV (1.42.0) and compile on more architectures
• Test the power set of features on Stable
2020-10-13 21:49:00 +01:00
Benjamin Sago
6eb5cee634 Convert manual pages to Markdown
This removes the "raw" man pages and converts them to Markdown, adding a build step using pandoc that converts them.

Having the man pages in Markdown makes them much, much easier to write and keep updated, at the cost of not having the raw formats easily available. Hopefully having the command to generate them in the Justfile will be enough.

It also splits out the EXA_COLORS environment variable into its own page, because it took up just under half of the one for the exa binary.
2020-10-13 20:19:00 +01:00
Benjamin Sago
002080cde8 Clippy pedantic lints
This commit fixes a couple of Clippy warnings, and adds the list of lints we're OK with.

It does raise some important warnings, such as those to do with casting, which aren't allowed so they can be fixed later.
2020-10-13 01:46:17 +01:00
Benjamin Sago
3dc86c99ad New set of lints, and Rust 2018 idioms 2020-10-13 01:36:41 +01:00
Benjamin Sago
f42957fab8 Merge branch 'modernise' 2020-10-13 01:28:55 +01:00
Benjamin Sago
80f9806bbc Move Git shared state to structs
This was being passed around everywhere as a parameter, when it can exist just as nicely as a struct field. This means many functions can take one argument less.
2020-10-13 01:28:42 +01:00
Benjamin Sago
ecbe63bf1e IO import changes 2020-10-13 00:54:06 +01:00
Benjamin Sago
6f2d8cc26c Have tests use OsStrs not OsStrings 2020-10-13 00:29:49 +01:00
Benjamin Sago
ed59428cbc Replace Misfire with a testable OptionsResult
This was meant to be a small change, but it spiralled into a big one.

The original intention was to separate OptionsResult and OptionsError. With these types separated, the Help and Version variants can only be returned from the Options::parse function, and the later option-parsing functions can only return success or errors.

Also, Misfire was a silly name.

As a side-effect of Options::parse returning OptionsResult instead of Result<Options, Misfire>, we could no longer use unwrap() or unwrap_err() to get the contents out. This commit makes OptionsResult into a value type, and Options::parse a pure function. It feels like it should be one, having its return value entirely dependent on its arguments, but it also loaded locales and time zones. These parts have been moved into lazy_static references, and the code still passes tests without much change.

OptionsResult isn't PartialEq yet, because the file colouring uses a Box internally.
2020-10-12 23:47:36 +01:00
Benjamin Sago
f8df02dae7 Batch source formatting
I read through every file and applied a couple of rustfmt suggestions. The brace placement and alignment of items on similar lines has been made consistent, even if neither are rustfmt's default style (a file has been put in place to enforce this). Other changes are:

• Alphabetical imports and modules
• Comma placement at the end of match blocks
• Use newlines and indentation judiciously
• Spaces around associated types
• Spaces after negations (it makes it more clear imho)
• Comment formatting
• Use early-returns and Optional `?` where appropriate
2020-10-10 20:02:55 +01:00
Benjamin Sago
c3c39fee0a Various misc clippy fixes 2020-10-10 15:57:40 +01:00
Benjamin Sago
a25cfe765d Remove some enum glob imports
These are holdovers from how I used to write Rust ("back in the day" of 2014). There are still some places in the code where I think it's worth glob-importing enums, but not these places.
2020-10-10 15:46:39 +01:00
Benjamin Sago
f0c139ca68 Better referencing
This commit makes changes to the way variables are referenced:

• Make types Copy when possible
• Make methods take `self` instead of `&self` where possible (trivially_copy_pass_by_ref)
• Remove unnecessary borrowing (needless_ref)
• Remove unnecessary cloning (clone_on_copy)
• Remove `ref` from match arms where possible (new Rust match ergonomics)
2020-10-10 15:30:19 +01:00
Benjamin Sago
70a30ed683 The Selfening
This commit uses Clippy to fix all the 'use_self' warnings. Using Self instead of the type name has been good Rust style for a while now, and it's become the style I'm used to seeing.
2020-10-10 13:55:26 +01:00
Benjamin Sago
74d9f1402b Some Clippy fixes 2020-10-10 13:33:50 +01:00
Benjamin Sago
39c3f15602 Simplify type signatures in main module
Exa::from_args used to be in the library, called by the binary, but now the binary is gone, it no longer needs to be as abstract. Instead of accepting a reference to a Write value, it takes a Stdout directly, which it owns itself, simplifying the type signature drastically.
2020-10-10 02:35:23 +01:00
Benjamin Sago
8046980806 Mass version upgrade
This upgrades the versions of everything, including upgrading almost all outdated dependencies.

• number_prefix had some backwards-incompatible changes. It now feels more Rustful, and spells "Mebi" correctly.
• term_grid stopped working when I upgraded it, worryingly, so I reverted it back.
2020-10-10 02:14:35 +01:00
Benjamin Sago
04e2d4c692 Just straight-up roll our own logger
This commit removes the env_logger dependency, replacing it with a simple implementation. Doing so removes like ten other transitive dependencies that no longer need to be included in the build.

It also gains the ability to enable trace-level logging. The users crate, which contains such logging statements as of the version I published a few days ago, has been upgraded to celebrate.

Also, change the log imports to globs. I'm only interested that a file doing logging, not what level it's logging at.
2020-10-10 02:01:12 +01:00
Benjamin Sago
3b209d1127 Cargo.lock metadata changes 2020-10-10 01:56:36 +01:00
Benjamin Sago
5ca3548bb1 Inline the library into the binary
This commit removes the library portion of exa. Cargo now only builds a binary.

The original intent was for exa to have its own internal library, and have the binary just call the library. This is usually done for code cleanliness reasons: it separates the code that implements the purpose of the program (the "plumbing") from the code that the user interacts with (the "porcelain"), ensuring a well-defined interface between the two.

However, in exa, this split was in completely the wrong place. Logging was handled in the binary, but option parsing was handled in the library. The library could theoretically print to any Writer ("for testing", it said), but it's far easier to run integration tests by executing the binary than to change the code to handle unit tests, so this abstraction isn't gaining us anything.

I've also had several people ask me if exa should be packaged for Linux distributions as a library, or just a binary. Clearly, this is confusing!

In several of my other Rust projects, I've done this better, with the command-line option parsing and log printing done on the binary side. It also turns out that you don't need to have a [lib] section in the Cargo.toml, so that's gone too.
2020-10-10 01:43:42 +01:00
Benjamin Sago
df81a24dae Use 0 and 1 rather than EXIT_SUCCESS/FAILURE
It doesn't seem right to use the EXIT_SUCCESS constant in one place, and a hard-coded 2 in another. What if they overlap?

Changing the success value to 0 should be OK, though, because the standard defines 0 as success, regardless of whether EXIT_SUCCESS is 0 or not.

Also, the values have become i32s. The Rust function std::process::exit takes an i32, so there's not much point using anything else.
2020-10-10 01:11:22 +01:00
Benjamin Sago
ee898bef8d Add commands to test feature combinations
Using the cargo-hack command, which now gets installed in the Vagrant environment, there's now an easy way to make sure exa can be built and test with all combinations of features.

There have been times in the past where exa has failed to build without the git feature, and I've just never noticed. This should put a stop to that.
2020-10-10 00:57:20 +01:00
Benjamin Sago
0550faec05 Replace Makefile with a developmental Justfile
This commit deletes the Makefile, which contained targets to build exa and install it on the local machine, and replaces it with a Justfile, which only contains command to build and test exa.

My reasoning for doing this is as follows:

• exa is increasingly being installed through package managers, rather than built and tested locally, so users are avoiding using the Makefile at all.
• It was a pain to keep up with the correct paths for installing the binary, man pages, and completions, which can vary between OSes. By removing them, the code in this repository need only concern itself with building exa and putting its files in the 'target' directory, simplifying things.
• just is much simpler than make conceptually, which is why I prefer it. It just runs commands, rather than being a complete build system, which we already use Cargo for.
• just has features built-in, such as listing tasks, that we've had to create make targets for.
• exa only needed a Makefile at all because it pre-dates Cargo!
• Other Rust projects seem to be getting along perfectly fine without one.

If I've missed some important reason that makes it worth keeping the Makefile around then please let me know.
2020-10-10 00:57:04 +01:00
Benjamin Sago
e95eb5e9fc Vagrant changes
• Get rid of the 'fresh' VM. It just got in the way, taking up more memory when 'vagrant up' was used, and only solved one problem  that was happening three years ago when I was at RustFest and in a programm-y mood.
• Use a more up-to-date Ubuntu image and give the machine more cores.
• Start moving some of the developer tools out of this repo. As I get more and more Rust projects, I don't want the scripts to package them to be repeated in each repository.
2020-10-10 00:21:20 +01:00
Benjamin Sago
e44858eb41 Fix bug where files were Git-ignored too often
This was an unintended consequence of #653. The Files iterator stopped using IgnoreCache and started using GitCache, which would always populated when the `--git` option was passed, without checking whether files were meant to be ignored. This meant that passing `--git` started ignoring files even without `--git-ignore`.

The solution for now is to explicitly pass the flag around, which probably should be a better type than bool but isn't. This makes the git-ignoring-related extended tests pass.
2020-10-10 00:09:44 +01:00
Benjamin Sago
7f9773b68e Merge branch 'zachcoyle-add-nix-icon' 2020-10-08 22:56:24 +01:00
Benjamin Sago
fd3a3d13b7 Merge branch 'add-nix-icon' of https://github.com/zachcoyle/exa into zachcoyle-add-nix-icon
# Conflicts:
#	src/output/icons.rs
2020-10-08 22:56:16 +01:00
Benjamin Sago
dee447213c
Merge pull request #743 from jonhoo/patch-1
Add additional TeX compiled files
2020-10-08 22:43:24 +01:00
Benjamin Sago
c167046c34
Merge pull request #735 from Finermeerkat137/pull_req
add ko to compiled objects
2020-10-08 22:42:30 +01:00
Benjamin Sago
9240dbdef3
Merge pull request #734 from imsofi/master
Fix icons for symlinked directories
2020-10-08 22:41:59 +01:00
Benjamin Sago
6f20f195a7
Merge pull request #726 from 0x3333/master
Fixes #719. Change August to Aug.
2020-10-08 22:38:25 +01:00
Benjamin Sago
8b852cb201
Merge pull request #725 from kbravh/tz-variable-patch
Update determine_time_zone function to check TZ
2020-10-08 22:37:00 +01:00
Benjamin Sago
ba5547b74b Merge branch 'JavaCafe01-master' 2020-10-08 22:30:27 +01:00
Benjamin Sago
d03e39c367 Merge branch 'master' of https://github.com/JavaCafe01/exa into JavaCafe01-master
Change a bunch of the existing shell-related icons to the new Unicode escape.
# Conflicts:
#	src/output/icons.rs
2020-10-08 22:30:20 +01:00
Benjamin Sago
8c3748ca35 Merge branch 'DiegoMagdaleno-master' 2020-10-08 22:24:06 +01:00
Benjamin Sago
1ee8fab7de Merge branch 'master' of https://github.com/DiegoMagdaleno/exa into DiegoMagdaleno-master
# Conflicts:
#	src/output/icons.rs
2020-10-08 22:23:18 +01:00
Benjamin Sago
083cf147be
Merge pull request #709 from poliorcetics/add-apple-filetypes
Add the documents extension for Apple file formats
2020-10-08 22:17:45 +01:00
Benjamin Sago
dbbc4e465b
Merge pull request #704 from LarsHaalck/master
Add --octal-permissions argument
2020-10-08 22:14:38 +01:00
Benjamin Sago
5cf22677e1
Merge pull request #703 from dalisoft/patch-1
build: use binary name only
2020-10-08 22:12:17 +01:00
Benjamin Sago
ea62aab37e
Merge pull request #690 from schlessera/add/php-immediate-files
Add immediate file types for PHP ecosystem
2020-10-08 22:11:01 +01:00
Benjamin Sago
cba2070924
Merge pull request #678 from olshevskiy87/display_git_status_conflicted
git-feature: display if a file is updated but unmerged (conflicted)
2020-10-08 22:10:33 +01:00
Benjamin Sago
5555faf64c Merge branch 'danielbayley-master' into master 2020-10-08 22:00:48 +01:00
Benjamin Sago
12e45ac41c Merge branch 'master' of https://github.com/danielbayley/exa into danielbayley-master
# Conflicts:
#	src/output/icons.rs
2020-10-08 22:00:36 +01:00
Benjamin Sago
d901bb289c
Merge pull request #654 from ariasuni/cleaning
Clean code a bit and fix typos in code documentation
2020-10-08 21:49:20 +01:00