Commit Graph

37 Commits

Author SHA1 Message Date
Casey Rodarmor
aefdcea7d0
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
  to be implicitly inherited by subprocesses, we now use
  `Command::current_dir` to set it explicitly. This feels much better,
  since we aren't dependent on the implicit state of the process's
  current directory.

- Subcommand execution is much improved.

- Added a ton of tests for config parsing, config execution, working
  dir, and search dir.

- Error messages are improved. Many more will be colored.

- The Config is now onwed, instead of borrowing from the arguments and
  the `clap::ArgMatches` object. This is a huge ergonomic improvement,
  especially in tests, and I don't think anyone will notice.

- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
  matching git, which I think is what most people will expect.

- Added a cute `tmptree!{}` macro, for creating temporary directories
  populated with directories and files for tests.

- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
Casey Rodarmor
b2285ce0e0
Reform Parser (#509)
Just's first parser performed both parsing, i.e the transformation of a
token stream according to the language grammar, and a number of consistency
checks and analysis passes.

This made parsing and analysis quite complex, so this diff introduces a
new, much cleaner `Parser`, and moves existing analysis into a dedicated
`Analyzer`.
2019-11-07 10:55:15 -08:00
Casey Rodarmor
83f40aa805
Improve messages for alias error messages (#500) 2019-10-19 20:00:41 -07:00
Casey Rodarmor
49ab423592
Refactor lexer tests (#498)
- Refactor the lexer tests to be more readable, abandoning the
  previous string-based summary DSL in favor of a more obvious
  sequence of `TokenKinds` with optional lexemes. The new tests
  also test that token lexemes are correct.

- Move duplicated `unindent` function into a shared crate,
  `test-utilities`. This new versionless dev-dependency will
  prevent publishing to crates.io, at least until rust-lang/cargo/pull/7333
  makes it into stable. If we publish a new version before then,
  test-utilities will need to be published to crates.io, so we can depend
  on it by version.
2019-10-17 20:04:54 -07:00
Casey Rodarmor
64ed94c8ac
Use more indented strings in integration tests (#489)
Changes by @aquarhead, but git merge clobbered original authorship.
2019-10-08 22:56:42 -07:00
Casey Rodarmor
bd75c5f51d
Avoid using error code 1 in integration tests (#486)
Since error code 1 is commonly used to indicate failure, change those
integration tests which test that a specific error code is returned to
use something other than 1.
2019-10-08 22:03:59 -07:00
Casey Rodarmor
11c253a213
Add unindent() for nicer integration test strings (#481)
Adds an `unindent()` function that strips common leading indentation
from strings, and apply it to integration test case strings, so that they
can be written in a more readable style.
2019-10-07 00:32:51 -07:00
Casey Rodarmor
633f0ccaa6
Allow integration test cases to omit common values (#480) 2019-10-06 00:32:16 -07:00
Casey Rodarmor
be3ec13d1c
Use bash as shell for all integration tests (#479)
This commit changes the integration tests to run with bash
as the shell, instead of bash, dash, and the system's sh.

Running the integration tests with multiple shells has never
revealed a bug in Just, and they make the tests take longer,
so let's get rid of them.
2019-10-05 23:08:22 -07:00
Casey Rodarmor
1230af138c
Add context to deprecation warnings (#473)
Previously, warnings upon encountering a deprecated use `=` in
assignments, exports, and aliases would print a message without any
indication of where the offending `=` was. This diff adds a proper
`Warning` enum, and uses it to report context, as is done with
compilation and runtime errors.
2019-09-21 18:53:30 -07:00
Casey Rodarmor
e8c25423b8 Display alias with --show NAME if one exists
Given the following justfile:

    alias b := build
    build:
        echo 'Building!'

Just will show the alias along with the recipe:

    $ just --show b
    alias b := build
    build:
        echo 'Building!'
2019-08-23 21:46:57 -07:00
Niklas Claesson
ff91e3d7c6 Use tempfile crate instead of tempdir (#455) 2019-07-06 20:55:46 -07:00
Casey Rodarmor
9b08ce6fd8
Display alias target with --show (#443) 2019-05-15 15:43:47 -04:00
Casey Rodarmor
22e96447b4
Replace colored_diff with pretty_assertions (#440) 2019-05-15 14:38:36 -04:00
Casey Rodarmor
415c84ea39
Refactor and rename test macros (#415) 2019-04-19 02:17:43 -07:00
Casey Rodarmor
0ad5574ecc
Deprecate = in assignments, aliases, and exports in favor of := (#413) 2019-04-18 11:48:02 -07:00
Casey Rodarmor
eb3ae2d093
Replace some calls to brev crate (#410) 2019-04-16 22:06:28 -07:00
Casey Rodarmor
792b7a249c
Pass stdin handle to backtick process (#409) 2019-04-16 19:52:16 -07:00
Casey Rodarmor
596ea34460
Replace regex-based lexer with character-at-a-time lexer (#406) 2019-04-15 22:40:02 -07:00
Casey Rodarmor
fe0a6c252c
Allow arbitrary expressions as default arguments (#400) 2019-04-11 23:58:08 -07:00
Casey Rodarmor
e118051a5c
Omit aliases that begin with _ from --list` (#398) 2019-04-11 15:57:34 -07:00
Casey Rodarmor
3a287b864a
Housekeeping (#394)
- Upgrade to rust 2018
- Update dependencies
- Use BTree{Map,Set} instead of Map and Set
2019-04-11 15:23:14 -07:00
ryloric
f64f07a0cc Add recipe aliases (#390)
Recipe aliases may be defined with `alias f = foo`, allowing recipes to be called by shorter names on the command line.
2019-04-11 12:30:29 -07:00
Casey Rodarmor
37639d68d7
Allow shebang lines so justfiles can be used as scripts (#393) 2019-04-08 14:28:17 -07:00
Casey Rodarmor
3d67786aaf
Förmatterdämmerung (#346)
Format with rustfmt
2018-12-08 14:29:41 -08:00
ladysamantha
af97f3f1c1 Print recipe signature if missing arguments (#369) 2018-11-03 14:51:06 -07:00
Casey Rodarmor
f0404d434c
Fix integration tests with dash (#338)
Integration tests run with bash, dash, and whatever's installed as `sh`, to ensure compatibility with a wide range of systems.

This commit changed the way that dash escapes special characters, which broke the integration tests:

https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=6900ff60ef7347a8c1445853a8f4689808e0976e

This commit modifies our tests to be compatible with dash before and after the changes, and should fix the Travis build.
2018-08-03 19:53:06 -07:00
Casey Rodarmor
438b5147fe
Improve invalid escape sequence error messages (#328)
The invalid escape sequence error message is delimited with backticks
and isn't used as input to other programs. This diff tweaks the escaping rules
slightly when printing invalid escape sequences. In particular, `, \, ',
and " are now not be escaped.
2018-06-30 22:19:13 -04:00
Casey Rodarmor
68b343bc17
Make .env vars available in env_var functions (#310) 2018-03-17 09:17:41 -07:00
Casey Rodarmor
70234f6193
Add dotenv integration (#306) 2018-03-05 13:21:35 -08:00
Casey Rodarmor
0e42d1435b
Bump version to 0.3.8 and update dependencies (#304) 2018-02-16 01:24:38 -08:00
Casey Rodarmor
79c0994387
Add env_var(key) and env_var_or_default(key, default) functions (#280)
`env_var(key)` looks up the value of the environment variable with name `key`, aborting execution if it is not found.

`env_var_or_default(key, default)` looks up the value of the environment variable with name `key`, returning `default` if it is not found.
2017-12-02 23:59:07 +01:00
Casey Rodarmor
afa4aebd4a
Add functions (#277)
– Parse unary (no-argument) functions
– Add functions for detecting the current os, arch, and os family, according to rustc's cfg attributes
2017-12-02 14:37:10 +01:00
Casey Rodarmor
c5eeb8944e
Align doc-comments in --list output (#273) 2017-12-01 00:03:59 +01:00
Casey Rodarmor
19a559c868
Misc fixes before publishing new version (#271) 2017-11-30 19:38:44 +01:00
Travis snɯǝᗡɔW
acb5d6f98b Do not evaluate backticks in assignments during dry runs (#253) 2017-11-17 20:21:37 -08:00
Casey Rodarmor
2b6b715528
Refactor Everything (#250) 2017-11-16 23:30:08 -08:00