Commit Graph

39 Commits

Author SHA1 Message Date
Casey Rodarmor
91d1e59667 Fix override argument processing bug (#115)
An invocation like `just foo=bar` would lead to no recipe being run due
to the way that override arguments were being processed.

Fix that and add a test that covers that case.
2016-11-13 21:26:28 -08:00
Casey Rodarmor
10c377b88c Allow ' raw strings to contain literal newlines (#107)
Fixes #8
2016-11-13 14:04:20 -08:00
Casey Rodarmor
2b81dc2b76 Fix spurious circular dependency error (#102)
The resolver.seen() needs to be cleared between recipes.

Also add push recipe for creating branches on github without needing to
create one locally.
2016-11-13 00:01:42 -08:00
Casey Rodarmor
26bfef4a2f Add doc comments to recipes (#101)
If a `#...` comment appears on the line immediately before a recipe, it
is considered to be a doc comment for that recipe.

Doc comments will be printed when recipes are `--list`ed or `--dump`ed.

Also adds some color to the `--list`ing.

Fixes #84
2016-11-12 23:31:19 -08:00
Casey Rodarmor
112462ec62 Toggle meaning of '@' on recipes prefixed with '@' (#100)
Fixes #65
2016-11-12 16:12:00 -08:00
Casey Rodarmor
babe97bf0d Allow line continuations in plain recipes with '\' (#99)
Some ugly code, but not as bad as I thought.

Elected not to go with indentation based line continuations. Too many
weird edge cases and feels like a gratuitious incompatibility with make.

Fixes #9
2016-11-12 15:45:12 -08:00
Casey Rodarmor
7cfc37f647 Line up names in --evaluate (#93)
Fixes #66
2016-11-12 13:12:43 -08:00
Casey Rodarmor
edbd94d654 Test that overrides are not evaluated (#92) 2016-11-12 13:03:33 -08:00
Casey Rodarmor
3d8d901968 Suggest alternatives to uknown recipes (#91)
Kind of silly, but why not. Will only suggest an alternative if edit
distance is less than 3. This could probably increase if the names are
longer.
2016-11-12 12:36:12 -08:00
Casey Rodarmor
6e8289c624 Make --list print recipes with arguments (#88)
Added `--summary` which just prints recipe names, like `--list` previous
to this change.

Fixes #75
2016-11-12 11:40:52 -08:00
Casey Rodarmor
95edb8ac3c Fix long lines (#80) 2016-11-12 09:28:30 -08:00
Casey Rodarmor
886acf2f95 Let recipes take default arguments (#77)
Looks like this:

```make
recipe argument default-argument='default value':
  echo argument is {{argument}}
  echo default-argument is {{default-argument}}
```

Thanks @deckarep for the feature request!

Fixes #49
2016-11-12 09:15:13 -08:00
Casey Rodarmor
98990fe2ab Use clap's conflicts_with and requires (#68)
Seems better than writing it by hand.
2016-11-11 20:47:17 -08:00
Casey Rodarmor
0f9fb418a0 Add --dump option to print entire justfile (#67)
Already implemented Display for Justfile, so no reason not to expose it
to the user.

Also only allow one of --list, --dump, or --show, since they don't make
a lot of sense together.
2016-11-11 20:25:37 -08:00
Casey Rodarmor
2882b78de5 Don't ignore --color=never (#56)
Fixes a bug where `--color=never` was ignored.
2016-11-11 18:46:04 -08:00
Casey Rodarmor
ac7634000e Fix error messages with wide character
Input may contain tabs and other characters whose byte widths do not
correspond to their display widths. This causes error context
underlining to be off when lines contain those characters

Fixed by properly accounting for the display width of characters, as
well as replacing tabs with spaces when printing error messages.
2016-11-11 17:32:35 -08:00
Casey Rodarmor
4d20ffeac4 Use colors in output
This is a pretty gross commit, since it also includes a lot of
unrelated refactoring, especially of how error messages are printed.

Also adds a lint recipe that prints lines over 100 characters

To test, I added a `--color=[auto|always|never]` option that defaults to
auto in normal use, but can be forced to `always` for testing. In `auto`
mode it defers to `atty` to figure out if the current stream is a
terminal and uses color if so.

Color printing is controlled by the `alternate` formatting flag.

When printing an error message, using `{:#}` will print it with colors
and `{}` will print it normally.
2016-11-11 17:32:35 -08:00
Casey Rodarmor
6b888bbfe4 Fix off by one error in backtick error message (#52)
I was using the width of the index of the line, not the displayed line
number, which is the index + 1, which could cause the error message to
be misaligned.

Fixed it, and added a test that checks for this.
2016-11-11 17:15:16 -08:00
Casey Rodarmor
2bc55ba815 Improve a few error messages (#47)
Surround variables with backticks, capitalize first letter of error
message, inflect properly depending on number of unknown overrides, and
improve wording.

Also added build dependency to `filter` recipe.
2016-11-11 14:33:17 -08:00
Casey Rodarmor
e3aa13e5dd Add integration tests for arguments (#42)
There were unit tests, but it seems like a good idea to test this end to end.
2016-11-11 13:34:28 -08:00
Casey Rodarmor
9a742e6336 Allow justfile to be named Justfile (#19)
Priority is given to `justfile` to match the behavior of GNU make.
2016-11-05 01:25:36 -07:00
Casey Rodarmor
adef254b23 Avoid bashisms in tests (#18)
Since `sh` might be different depending on the system, avoid testing
status codes and error messages that are not the same across all `sh`s
2016-11-05 01:19:54 -07:00
Casey Rodarmor
e4d35a8270 Add --quiet/-q flag to supress all output (#17)
This is for avoiding writing to stderr during tests,
although it's a nice option so it feels worth exposing
to users.
2016-11-05 01:01:43 -07:00
Casey Rodarmor
cef8b4fbdf Updated readme 2016-10-31 21:53:31 -07:00
Casey Rodarmor
9e9b525369 Bump version to 0.2.11 and rename back to just 2016-10-30 18:12:59 -07:00
Casey Rodarmor
1290c5a8bd Added raw '' strings 2016-10-30 16:56:22 -07:00
Casey Rodarmor
69f8e07a30 export variables done 2016-10-30 16:15:18 -07:00
Casey Rodarmor
cc683cbb04 Bump version, add --debug 2016-10-30 13:14:39 -07:00
Casey Rodarmor
9a368fb351 variable=value overrides done 2016-10-30 03:08:28 -07:00
Casey Rodarmor
25c6432fa3 Backtick tests done! 2016-10-30 01:27:05 -07:00
Casey Rodarmor
980c5d0b33 Backticks implemented. Error messages still suck though. 2016-10-30 00:20:29 -07:00
Casey Rodarmor
70e9d4e653 Refactoring. Checkpoint commit. 2016-10-29 21:51:39 -07:00
Casey Rodarmor
58fb70e16e Surround tokens with `` in errors 2016-10-28 20:40:16 -07:00
Casey Rodarmor
0f29b4fc2a Pretty errors with underlined tokens! 2016-10-28 20:34:25 -07:00
Casey Rodarmor
383754d2fb More tests 2016-10-28 19:38:32 -07:00
Casey Rodarmor
01df3d5e4a Add {:#} format printing to justfile for --show 2016-10-28 16:32:13 -07:00
Casey Rodarmor
a8a5c342e7 More integration tests 2016-10-28 15:59:50 -07:00
Casey Rodarmor
e011f91656 Move order test to integration tests 2016-10-28 15:34:01 -07:00
Casey Rodarmor
a1722fe241 Add integration tests 2016-10-28 15:25:59 -07:00