181 Commits

Author SHA1 Message Date
Casey Rodarmor
a1bd70a030
Run recipes with working directory set to submodule directory () 2023-12-29 00:55:36 +00:00
Casey Rodarmor
92bae080ab
List included recipes in load order () 2023-11-25 07:15:41 +00:00
Greg Shuflin
f745316e88
Move !include processing into compiler () 2023-11-21 11:28:59 -08:00
Yuri Astrakhan
be7f161554
Misc fixes () 2023-10-17 03:07:09 +00:00
Yuri Astrakhan
a1220c63e3
Cleanup () 2023-06-12 16:53:55 +00:00
Casey Rodarmor
67b264c878
Ignore clippy::let_underscore_untyped () 2023-05-28 00:42:52 +00:00
Greg Shuflin
054d6672c5
Analyze and Compiler tweaks () 2023-01-27 03:03:04 +00:00
Cameron Steffen
216df31543
Eliminate lazy_static () 2022-12-15 16:53:21 -08:00
Gökhan Karabulut
8b7640b633
Add [no-exit-message] recipe annotation ()
When a recipe wraps cli tool and the tool exits with a non-zero code,
just adds its own extra exit error message along with the messages
from the tool. Introduce the `[no-exit-message]` attribute to suppress
this additional message.
2022-10-25 16:32:36 -07:00
Greg Shuflin
e445cfb47d
Add skip-comments setting ()
Add a new setting "skip-comments", which defaults to true. If unset,
this causes lines internal to a non-shebang recipe beginning with the
character '#' (including '#!' internal to a non-shebang recipe; that is,
any such instances occurring after the first line of a recipe) to be
treated as comments of the justfile itself. They will not be echoed to
stderr when the recipe executes.
2022-10-05 00:32:30 +00:00
Casey Rodarmor
c115b3f317
Allow fewer lints () 2022-09-11 09:25:38 +00:00
Casey Rodarmor
4a4c669db9
Split Recipe::run into Recipe::{run_shebang,run_linewise} () 2022-07-21 01:46:52 +00:00
Evan Richter
eef0138599
Restore fuzz test harness () 2022-06-21 02:16:02 +00:00
Casey Rodarmor
01fae9b1e4
Do use super::*; instead of use crate::common::*; () 2022-06-19 04:56:31 +00:00
Casey Rodarmor
c24a194602
Add windows-shell setting () 2022-05-31 13:01:59 -07:00
Casey Rodarmor
5995221555
Change dotenv-load default to false ()
This changes the default value of `dotenv-load` from `true` to `false`. This
is a backwards incompatible change, and will require a minor version bump.
2022-02-02 03:16:35 +00:00
Casey Rodarmor
27cd8fd554
Remove call to sed in justfile () 2022-01-30 20:16:10 +00:00
Casey Rodarmor
0ae91884e2
Add --dump-format json () 2021-11-17 00:07:48 -08:00
Casey Rodarmor
0db4589efe
Implement regular expression match conditionals () 2021-09-16 23:45:56 +00:00
Casey Rodarmor
09af9bb5e5
Change MSRV to 1.46.0 () 2021-09-16 14:51:45 +00:00
Casey Rodarmor
27cf2b96df
Use ColorDisplay trait to print objects to the terminal () 2021-07-29 01:06:57 +00:00
Casey Rodarmor
ce0376cfdf
Move subcommand functions into Subcommand () 2021-07-27 00:19:52 +00:00
Casey Rodarmor
1b0fafea75
Add loader and refactor errors ()
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
98457c05d7
Rename: Module → Ast () 2021-07-24 03:26:27 +00:00
Casey Rodarmor
0fea73455b
Fix circular variable dependency error message () 2021-07-20 01:10:35 +00:00
Casey Rodarmor
4cb82e0c1f
Remove summary feature ()
Remove the `summary` feature and make the `summary` module always build.
It's a small module, so it shouldn't hurt compile times, and it should
prevent accidental breakages that are only caught on CI.
2021-05-08 19:07:51 -07:00
Casey Rodarmor
7bc9d3986e
Fix bang lexing and placate clippy () 2021-05-07 00:14:38 -07:00
Casey Rodarmor
fec979c2c6
Reform and improve string literals ()
- 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
dd578d141c
Unify string lexing ()
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
7ae890ce61
Note shebang line splitting inconsistency in readme () 2021-02-15 01:18:31 -08:00
Casey Rodarmor
1fc4842e4c
Fix CI ()
- Replace `::add-path::` CI command with environment files
- Placate Clippy
- Consolidate cache actions
2020-11-19 14:47:04 -08:00
Casey Rodarmor
aa506fa5bd
Allow ignore line endings inside delimiters ()
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
bdf1c92251
Automatically track expected tokens while parsing ()
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
526badbd6f
Placate clippy () 2020-10-09 15:44:17 -07:00
Casey Rodarmor
837b6e6a00
Skip .env items which are set in environment ()
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
Richard Berry
1ff619295c
Add variadic parameters that accept zero or more arguments ()
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
Matt Boulanger
dc7210bca3
Suggest aliases for unknown recipes () 2020-04-26 14:19:21 -07:00
Casey Rodarmor
2b688d4858
Trigger build on pushes and pull requests () 2020-03-13 21:20:41 -07:00
Casey Rodarmor
b1ebf63124
Improve comments in justfile () 2020-01-31 00:47:48 -08:00
Casey Rodarmor
f50196a67f
Check long lines and FIXME/TODO on CI () 2020-01-15 02:30:24 -08:00
Casey Rodarmor
ed991cb509
Add additional continuous integration checks ()
Add GitHub Actions checks:

- Clippy is placated
- Rustfmt doesn't produce any changes
- Shell completion scripts are current
2020-01-15 02:16:13 -08:00
Casey Rodarmor
bb4afe1481
Reform indentation handling ()
Improve indentation handling in preparation for implementing inline
submodules. This changes the lexer to only parse freeform text inside
the first indent after a ':', so that just can be extended with new
indented constructs which are not recipe bodies. In addition, the lexer
should now handle multiple levels of indentation correctly.
2019-12-11 20:25:16 -08:00
Casey Rodarmor
0931fa8dbf
Allow passing arguments to dependencies ()
Allow recipes that take parameters to be used as dependencies.
2019-12-07 04:03:03 -08:00
Casey Rodarmor
2d3134a91c
Reform scope and binding ()
Clean up scope handling by introducing `Binding` and `Scope` objects.
2019-12-07 03:09:21 -08:00
Casey Rodarmor
d2decbfdb8
Resolve functions ()
Modifies parsing to return strongly-typed `Thunk`s, which contain both
the function implementation, as well as the correct number of arguments.

This moves unknown function and function argument count mismatch errors
to parse time.
2019-11-21 12:14:10 -06:00
Casey Rodarmor
4f08bb4d77
Resolve alias targets ()
During analysis, resolve alias targets from `Name`s to `Rc<Recipe>`,
giving us type-level assurance that alias resolution was performed, and
avoiding the need to look up alias targets in a separate table when
running.
2019-11-21 09:39:32 -06:00
Casey Rodarmor
30c77f8d03
Resolve recipe dependencies ()
Make analysis resolve recipe dependencies from names (`Name`) to recipes
(`Rc<Recipe>`), to give type-level certainty that resolution was performed
correctly and remove the need to look up dependencies on run.
2019-11-21 08:23:32 -06:00
Casey Rodarmor
598f1c3200
Refactor Compilation error to contain a Token ()
Use a `Token` to represent the error context, instead of a mess of
fields. Remove write_message_context in favor of `Token::write_context`.
2019-11-13 19:32:50 -08:00
Casey Rodarmor
e80bf34d9a
Add shell setting ()
Add a `set SETTING := VALUE` construct.

This construct is intended to be extended as needed with new settings,
but for now we're starting with `set shell := [COMMAND, ARG1, ...]`,
which allows setting the shell to use for recipe and backtick execution
in a justfile.

One of the primary reasons for adding this feature is to have a better
story on windows, where users are forced to scrounge up an `sh` binary
if they want to use `just`. This should allow them to use cmd.exe or
powershell in their justfiles, making just optionally dependency-free.
2019-11-10 23:17:47 -08:00
Casey Rodarmor
177516bcbe
Reform positional argument parsing ()
This diff makes positional argument parsing much cleaner, along with
adding a bunch of tests. Just's positional argument parsing is rather,
complex, so hopefully this reform allows it to both be correct and stay
correct.

User-visible changes:

- `just ..` is now accepted, with the same effect as `just ../`

- `just .` is also accepted, with the same effect as `just`

- It is now an error to pass arguments or overrides to subcommands
  that do not accept them, namely `--dump`, `--edit`, `--list`,
  `--show`, and `--summary`. It is also an error to pass arguments to
  `--evaluate`, although `--evaluate` does of course still accept
  overrides.

  (This is a breaking change, but hopefully worth it, as it will allow us
  to add arguments to subcommands which did not previously take
  them, if we so desire.)

- Subcommands which do not accept arguments may now accept a
  single search-directory argument, so `just --list ../` and
  `just --dump foo/` are now accepted, with the former starting the
  search for the justfile to list in the parent directory, and the latter
  starting the search for the justfile to dump in `foo`.
2019-11-10 18:02:36 -08:00