Commit Graph

111 Commits

Author SHA1 Message Date
Casey Rodarmor
1b0fafea75
Add loader and refactor errors (#917)
This commit adds a `Loader` type, which can be used to load multiple
source strings. This was done to support the work on modules, but
coincidentally enabled consolidating errors, since now `Config::run`
can take a `&Loader`, and in the event of an error, return and `Error`
that borrows from loaded strings. Multiple error types have been
consolidated, and a bunch of ad-hoc error printing was removed.
2021-07-26 01:26:06 -07:00
Casey Rodarmor
77bba3ee0e
Add subsequent dependencies (#820)
Subsequents are dependencies which run after a recipe instead of prior.
Subsequents to a recipe only run if the recipe succeeds. Subsequents
will run even if a matching invocation already ran as a prior
dependencies.
2021-07-22 00:20:25 -07:00
Casey Rodarmor
c76805ab9e
Implement else if chaining (#910) 2021-07-20 01:21:46 +00:00
Casey Rodarmor
0fea73455b
Fix circular variable dependency error message (#909) 2021-07-20 01:10:35 +00:00
Casey Rodarmor
d797592365
Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
Liam
a24c86ed5a
Add string manipulation functions (#888) 2021-07-03 19:39:45 +00:00
Casey Rodarmor
024f8279bc
Add clean function for simplifying paths (#883) 2021-06-25 06:41:20 +00:00
Casey Rodarmor
87e395254b
Add join function for joining paths (#882) 2021-06-24 22:55:29 +00:00
Frederick Zhang
9dc2385c64
Add file_extensions to Sublime syntax file (#878) 2021-06-24 08:24:12 +00:00
Antonio Gelameris
162d2df1ba
Add path manipulation functions (#872) 2021-06-17 07:56:09 +00:00
Casey Rodarmor
a6453ded99
Add --unstable flag (#869)
Add an `--unstable` flag, indicating that `just` should enable unstable
features. Make `--fmt` only run if `--unstable` is passed.
2021-06-12 22:34:41 +00:00
Oleksii Dorozhkin
8677492d56
Add --fmt subcommand (#837) 2021-06-08 01:01:27 -07:00
Casey Rodarmor
28fdd36430
Remove dotenv_load from tests (#853) 2021-06-03 01:12:39 -04:00
Casey Rodarmor
acc7494268
Improve install script (#847)
- Allow passing `--target` to select target
- Guess target from OS and architecture
2021-05-27 23:16:45 -07:00
Lynx Zhou
7be66f890f
Add shebang support for 'cmd.exe' (#828) 2021-05-16 00:33:41 -05:00
sigoden
cba52c9d65
Add .exe to powershell scripts (#826) 2021-05-11 12:21:49 -07:00
Casey Rodarmor
50cd24d37b
Add the --command subcommand (#824) 2021-05-10 03:35:35 +00:00
Casey Rodarmor
2abdeb386e
Pass evaluated arguments as positional arguments (#810) 2021-05-02 10:25:43 +00:00
Casey Rodarmor
09b370e10d
Change --eval to print variable value only (#806) 2021-04-25 17:02:57 -07:00
Casey Rodarmor
67bd318bf9
Add positional-arguments setting (#804)
Allow recipe arguments to be passed as positional arguments to commands.
2021-04-24 18:29:58 -07:00
Casey Rodarmor
d03aedd5c4
Allow filtering variables to evaluate (#795)
If variable names are passed to `--evaluate`, only print those
variables.
2021-04-05 21:50:50 -07:00
Casey Rodarmor
fec979c2c6
Reform and improve string literals (#793)
- Combine and simplify string and backtick lexing.
- Allow newlines in strings and backticks.
- Add triple-delimited indented strings and backticks. Common indented literal non-blank line leading whitespace is stripped.
- If a literal newline is escaped, it will be suppressed.
- Backticks starting with `#!` are reserved for a future upgrade.
2021-04-05 21:28:37 -07:00
Casey Rodarmor
da97f8d7dd
Allow evaluating justfiles with no recipes (#794) 2021-04-05 21:17:53 -07:00
Casey Rodarmor
dd578d141c
Unify string lexing (#790)
Unify lexing of backticks, cooked strings, and raw strings. Also allow
newlines in backticks and cooked strings, since I can't think of a reason
not to.
2021-04-04 16:41:02 -07:00
Casey Rodarmor
78b67f6cae
Test multi-line strings in interpolation (#789)
The behavior here is strange, and unintentional, but not obviously wrong.
Add a test to make sure I don't accidentally break it in the future.
2021-04-03 19:59:13 -07:00
Casey Rodarmor
a1a016b4e0
Disable .env warning for now 2021-03-30 17:59:15 -07:00
Casey Rodarmor
e4ebf6dad9
Warn if .env file loaded and dotenv-load unset (#784) 2021-03-30 17:30:32 -07:00
Casey Rodarmor
10282bd636
Turn = deprecation warning into a hard error (#780)
It's been around two and a half years, and many versions, since this
warning was first introduced, so it feels reasonable to finally turn it
into a hard error. It will remain a special-cased error for a little
while.
2021-03-28 23:39:23 -07:00
Casey Rodarmor
18b9799e8d
Add dotenv-load setting (#778)
The `dotenv-load` setting controls whether or not a `.env` file will be
loaded if present. It currently defaults to true.
2021-03-28 22:38:07 -07:00
Benoit de Chezelles
13e9f406c8
Add just_executable() function (#775)
The `just_executable()` function returns the absolute path of the
currently running `just` executable.
2021-03-28 15:44:02 -07:00
Casey Rodarmor
6f42c8b737
Prefix parameters with $ to export to environment (#773)
If a parameter is prefixed with an `$`, it will be exported as an
environment variable.
2021-03-25 18:35:24 -07:00
Casey Rodarmor
b66a979c08
Add set export to export all variables as environment variables (#767)
Add a setting that exports all variables by default, regardless of
whether they use the `export` keyword. This includes assignments as well
as parameters.

Just does dependency analysis of variable uses, allowing variables to be
used out of order in assignments, as long as there are no circular
dependencies.

However, use of environment variable is not known to Just, so exported
variables are only exported to child scopes, to avoid ordering dependencies,
since dependency analysis cannot be done.
2021-03-25 17:00:32 -07:00
Casey Rodarmor
86c2e52dc6
Suppress all output to stderr when --quiet (#771)
Suppress all warnings and error messages when `--quiet` is passed.
2021-03-25 16:51:29 -07:00
Casey Rodarmor
d3b277c04c
Allow escaping double braces with {{{{ (#765) 2021-03-24 19:46:53 -07:00
Casey Rodarmor
7ae890ce61
Note shebang line splitting inconsistency in readme (#757) 2021-02-15 01:18:31 -08:00
Casey Rodarmor
bac851ff68
Add options to control list formatting (#753)
Add the `--list-heading` option, to override the heading text printed
before a list, defaulting to `Available recipes:\n`, and
`--list-prefix`, to override the indentation before each list item.
2021-02-09 01:00:20 -08:00
Casey Rodarmor
aa506fa5bd
Allow ignore line endings inside delimiters (#717)
Modify the lexer to keep track of opening `({[` and closing `]})` delimiters.
When the lexer would emit an eol or indent outside of a recipe when there
is at least one open delimiter, emit a whitespace token instead.

This allows expressions to be split on multiple lines, like so:

    x := if 'a' == 'b' {
      'x'
    } else {
      'y'
    }

This does not work inside of recipe body interpolations, although this
restriction might relaxed in the future.
2020-10-27 23:51:17 -07:00
Casey Rodarmor
19f7ad09a7
Add conditional expressions (#714)
Add conditional expressions of the form:

   foo := if lhs == rhs { then } else { otherwise }

`lhs`, `rhs`, `then`, and `otherwise` are all arbitrary expressions, and
can recursively include other conditionals. Conditionals short-circuit,
so the branch not taken isn't evaluated.

It is also possible to test for inequality with `==`.
2020-10-26 18:16:42 -07:00
Casey Rodarmor
bdf1c92251
Automatically track expected tokens while parsing (#711)
Remove all manual tracking of which tokens would have been accepted by
the parser in favor of having the parser add tokens that it checks for
to a set of expected tokens, clearing them when it accepts a token, and
using the current contents of the set in error messages.

This is a massive improvement, and will make the parser easier to
modify going forward.

And, this actually solves my sole issue with hand-written parsers.

Thanks to matklad on reddit for suggesting this!
2020-10-25 19:37:26 -07:00
Casey Rodarmor
d1efc18174
Allow choosing multiple recipes to run (#700)
Modifies the `--choose` subcommand to allow a chooser to return
space-separated recipe names recipes to run.
2020-10-10 17:54:58 -07:00
Will Speak
9bd0720aa1
Allow suppressing failures with - prefix (#687)
If a command in a linewise recipe is prefixed with `-`, then the exit
status is ignored and execution continues.
2020-10-03 13:54:19 -07:00
Casey Rodarmor
9d0246998d
Add the --choose subcommand (#680)
The `--choose` subcommand runs a chooser to select a recipe to run. The
chooser should read lines containing recipe names from standard input,
and write one of those names to standard output.

The chooser defaults to `fzf`, a popular fuzzy finder, but can be
overridden by setting $JUST_CHOOSER or passing `--chooser <CHOOSER>`.
2020-09-17 19:43:04 -07:00
Casey Rodarmor
55985aa242
Combine integration tests into single binary (#679)
Combine all integration test binaries into a single binary with the root
in `tests/lib.rs`. This also turns of automatic test discovery, so
when adding another set of integration tests, a mod statement will need
to be added to `tests/lib.rs`.
2020-09-17 17:59:46 -07:00
Casey Rodarmor
9ecfd2bef4
Add option to print recipes in source order (#669)
Add an `--unsorted` flag, which makes `--list` and `--summary` print
their entries in source order.
2020-08-21 15:13:54 -07:00
Casey Rodarmor
05d73a423a
Search for .env file from working directory (#661)
Search for a `.env` file starting in the  working directory, instead of
the invocation directory.
2020-07-19 05:01:46 -07:00
Casey Rodarmor
837b6e6a00
Skip .env items which are set in environment (#656)
If an environment variable exists with the same key as a variable from a
`.env` file, skip the variable from the `.env` file in favor fo the key
from the environment.
2020-07-16 21:37:33 -07:00
Casey Rodarmor
5533073f56
Only use cygpath on shebang if it contains / (#652)
On Windows, skip conversion if a shebang path does not include `/`. In
this case it is not a Unix path, and does not need to be converted to a
Windows path before running.
2020-06-27 16:38:56 -07:00
Richard Berry
1ff619295c
Add variadic parameters that accept zero or more arguments (#645)
Add "star" variadic parameters that accept zero or more arguments,
distinguished with a `*` in front of the parameter name.
2020-06-13 01:49:13 -07:00
Casey Rodarmor
d7a51e72f5
Test that example justfiles successfully parse (#643)
Parse all entries in `examples` as justfiles, to make sure that example
justfiles parse successfully.
2020-06-09 22:57:16 -07:00
Richard Berry
89ee05227b
Ignore '@' returned from interpolation evaluation (#636)
Only process literal `@` characters outside of interpolation evaluation.
2020-06-09 15:16:05 -07:00