Color logic is fairly complicated, so moved it into its own
module.
A `Color` object now encapsulates the --color setting, which
stream we are printing to, and what color we are painting.
This way, Color::paint can just do the right thing when asked to
paint text.
Also added tests to make sure that --list and --highlight colors
are using the correct color codes.
We use EXEPATH, which points to the root of the MinGW installation
and can be used as a base for translating the unix path to the
executable in the shebang line.
If we're not on MinGW, well, we just throw up our hands and hope
for the best.
I was reusing TmpdirIoError for a few cases, but one of them
usually has more to do with the contents of the shebang line than
an actual io error involving the tmpdir. Pull it out into its own
RunError variant and improve the message.
* Run integration tests on multiple shells
To make sure that I don't break tests for shells other than my
dev-box's `sh` and the `sh` on travis, each integration test case
now runs using `sh`, `dash`, and `bash.
Moves platform specific functionality into its own module.
Thanks to @Meralis40 for starting this!
This also gets just building on windows \^_^/
Although a lot of tests still fail (✖╭╮✖)
The `PlatformInterface` trait contains functions which abstract
over platform specific functionality, with implementations for
different platforms behind #[cfg(*)] attributes.
- `make_shebang_command()` constructs a command which will execute
the given script as if by a shebang. On linux this executes the
file, on windows it runs the interpreter directly.
- `set_execute_permission()` sets the execute permission on a
file. This is a nop on windows, since all files are executable.
- `signal_from_exit_status()` extracts the signal a process was
halted by from its exit status, if it was halted by a signal.
Mostly for debugging purposes, so I can make sure behavior is
consistent across different shells. Although I suppose this might
also be of use if you've got a mega weird `sh` that you'd like to
avoid.
Defaults to `sh` so current behavior is preserved.
- Unicode 9 defines emoji to be wide characters; before their
width was ambiguous. unicode-width has picked this up, so the
tests which expected emoji to be single-width have been updated.
- The ordering of the --quiet and --dry-run flags seems to be
have flipped in a clap error message, which broke a test, which
is unbroken by this commit
This is done for two reasons:
1. Such names cannot be given on the command line, since clap will
intercept them and wrongly interpret them as flags.
2. The name '---' can conflict with yaml document delimiters. Kind of
speculative, but I was thinking that it would be nice to make sure that
'---' and '...' are illegal in a justfile, so that that one can be
included in a yaml document stream. Is this silly? I am really not sure.
This is backwards incompatible, but I don't think anyone will notice,
since names that start with '-' are likely to be rare.
The recipe dependency resolver had a bug which caused it to not resolve
dependencies after the first.
This caused the parameter check later in the program to crash.
Added a test and fixed it.
Fixes#148.
If the first argument to just contains a `/`, then it will be handled
specially. Everything before the last `/` is treated as a directory, and
just will search for the justfile starting there, instead of in the
current directory.