Commit Graph

366 Commits

Author SHA1 Message Date
Casey Rodarmor
981465ad30
Release v0.7.1 (#662)
- Bump version: 0.7.0 → 0.7.1
- Update changelog
- Update man page
- Update config test
2020-07-19 05:10:38 -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
c1a0001939
Release v0.7.0 (#657)
- Bump version: 0.6.1 → 0.7.0
- Update dependencies
- Update changelog
- Update man page
- Update config test
2020-07-16 21:58:49 -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
7384307fdc
Release v0.6.1 (#653)
- Bump version: 0.6.0 → 0.6.1
- Update dependencies
- Update changelog
- Update man page
- Update config test
2020-06-28 15:07:03 -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
Casey Rodarmor
863fb53885
Release v0.6.0 (#649)
- Bump version: 0.5.11 -> 0.6.0
- Update dependencies
- Update changelog
- Update man page
- Update config test
2020-06-18 11:50:47 -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
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
Casey Rodarmor
2a9c29c18f
Strip leading spaces after line continuation (#635)
Make line continuations strip leading spaces on the next line.

This changes what is passed to the shell, so this is a breaking change.
However, I don't think that this will break any recipes.
2020-06-08 22:37:12 -07:00
Casey Rodarmor
2e6e48d8f4
Release v0.5.11 (#629)
- Bump version: `0.5.10` -> `0.5.11`
- Update changelog
- Update dependencies
- Update man page
- Update config test
- Publish to cargo last in release recipe
2020-05-23 20:59:11 -07:00
Casey Rodarmor
d6a1a2b568
Don't load .env file when --no-dotenv is passed (#627)
Add a `--no-dotenv` flag that suppresses loading `.env` files.
2020-05-23 20:41:12 -07:00
Tobin Yehle
fef69a3ec1
Complete recipe names in fish completion script (#625) 2020-05-03 20:35:53 -07:00
Matt Boulanger
dc7210bca3
Suggest aliases for unknown recipes (#624) 2020-04-26 14:19:21 -07:00
Casey Rodarmor
f73de24fd7
Add log variable to justfile (#621)
Allows logging to be controlled with, for example:

    just log=trace run
2020-03-31 00:00:05 -07:00
Casey Rodarmor
985a6a833d
Release v0.5.10 (#613)
- Bump version: `0.5.9` -> `0.5.10`
- Update changelog
- Update dependencies
- Update man page
- Update config test
- Fix publish and check recipes
2020-03-18 09:03:21 -07:00
Casey Rodarmor
8fea09a3dd
Release v0.5.9 (#612)
- Bump version number: `0.5.8` -> `0.5.9`
- Update changelog
- Update dependencies
- Update config test
- Add `pr` and `push` to justfile
2020-03-18 08:19:43 -07:00
Zhenhui Xie
e79482f2dc
Update zsh completion file (#606)
- Complete variable names after `--set`
- Complete recipe names
- Display recipe signature and body below command line
- Modify completions subcommand to produce enhanced zsh completion script
2020-03-16 17:20:14 -07:00
Casey Rodarmor
784232e98b
Trim completions and ensure final newline (#609)
Trim whitespace at beginning and end of generated completions.
Additionally, since some editors will automatically insert a final
newline into text files, make sure a final newline is present.
2020-03-14 21:41:57 -07:00
Casey Rodarmor
1dbc765390
Add --variables subcommand that prints variable names (#608)
Add a subcommand that prints out a space-separated list of the names of
top-level variables in the justfile.

The syntax is:

    $ just --variables
    a b c

This can be used for any purpose, but is mostly intended for completion
scripts, so that they can get the names of variables without using
`--evaluate`.

Additionally:

- Add `bin/generate-completions` script to regenerate checked-in
  completions
- Update dependencies
- Regenerate checked-in completions
2020-03-13 22:19:43 -07:00
Casey Rodarmor
2b688d4858
Trigger build on pushes and pull requests (#607) 2020-03-13 21:20:41 -07:00
Casey Rodarmor
dcc98abdf8
Don't require justfile to print completions (#596)
Currently, the `--completions` subcommand will fail if there is no
justfile present. A justfile isn't needed to print completions, so fix
this.
2020-02-20 06:07:25 -08:00
Casey Rodarmor
9731278d2a
Wrap comments at 80 characters (#593)
I think 70 is too agressive, especially since it includes indentation
when determining line length.
2020-02-14 04:49:25 -08:00
Casey Rodarmor
3ec7dea4a3
Use unstable rustfmt configuration options (#592) 2020-02-10 20:07:06 -08:00
Casey Rodarmor
aceee3e217
Release v0.5.7 (#591)
- Bump version: v0.5.7 -> v0.5.8
- Update changelog
- Update man page
- Update config test
- Update dependencies
2020-02-06 12:25:09 -08:00
Casey Rodarmor
b1ebf63124
Improve comments in justfile (#588) 2020-01-31 00:47:48 -08:00
Casey Rodarmor
1629235f2e
Only use cygpath on windows if present (#586) 2020-01-28 18:02:58 -08:00
Casey Rodarmor
1d084f1d4e
Release v0.5.7 (#584)
- Bump version: 0.5.6 -> 0.5.7
- Update change log
- Update man page
- Update config test
2020-01-28 03:03:07 -08:00
Casey Rodarmor
f3d5d124a4
Release v0.5.6 (#582)
- Bump version: 0.5.5 -> 0.5.6
- Update change log
- Update man page
- Update config test
2020-01-28 02:31:38 -08:00
Casey Rodarmor
56496e14bf
Release v0.5.5 (#576)
- Bump version: 0.5.4 -> 0.5.5
- Update changelog
- Update man page
- Update config test
2020-01-15 03:33:49 -08:00
Casey Rodarmor
f50196a67f
Check long lines and FIXME/TODO on CI (#575) 2020-01-15 02:30:24 -08:00
Casey Rodarmor
ed991cb509
Add additional continuous integration checks (#574)
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
85e8015702
Generate shell completion scripts with --completions (#572)
Make just print clap-generated shell completion scripts with `--completions`
command. Currently, Bash, Zsh, Fish, PowerShell, and Elvish are supported.

Additionally, the generated completion scripts are checked in to the
`completions` folder.
2020-01-15 01:20:38 -08:00
Casey Rodarmor
e14447030a
Release v0.5.4 (#570)
- Bump version: 0.5.3 -> 0.5.4
- Update changelog
- Update man page
- Update config test
2019-12-25 07:46:54 -08:00
Casey Rodarmor
61ab53dbc1
Add justfile_directory() and justfile() (#569)
Add `justfile()` function, returning the current justfile, and
`justfile_directory(), returning its parent directory.
2019-12-25 06:12:06 -08:00
Casey Rodarmor
fe906a1b6f
Fix regression in error message color printing (#566)
Make the word "error" print in red instead of plain text.
2019-12-12 17:55:55 -08:00
Casey Rodarmor
bb4afe1481
Reform indentation handling (#565)
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
320e2027a1
Release v0.5.3 (#563)
- Bump version: v0.5.2 -> v0.5.3
- Update changelog
2019-12-11 17:22:46 -08:00
Casey Rodarmor
49cd7f5a93
Improve pre-publish check (#562)
- Ensure man page is up to date
- Build with summary feature
2019-12-11 17:08:48 -08:00
Casey Rodarmor
9eb867dd15
Fix typo: chracter -> character (#561) 2019-12-10 15:10:22 -08:00
Casey Rodarmor
b5dea44ee7
Assert that lexer advances over entire input (#560) 2019-12-10 13:24:30 -08:00
Casey Rodarmor
20790a0cc7
Release v0.5.2 (#557)
- Bump version: v0.5.1 -> v0.5.2
- Update changelog
- Update dependencies
2019-12-07 04:59:58 -08:00
Casey Rodarmor
0931fa8dbf
Allow passing arguments to dependencies (#555)
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 (#556)
Clean up scope handling by introducing `Binding` and `Scope` objects.
2019-12-07 03:09:21 -08:00
Casey Rodarmor
d0e813cd8b
Add flags to set and clear shell arguments (#551)
Add the `--shell-arg` and `--clear-shell-args` flags, which allow
setting and clearing arguments to the shell from the command line.

This allows full control over the shell from the command line. Additionally,
any shell-related arguments on the command line override
 `set shell := [...]` in the Justfile, which I think will be the behavior that most
people expect.
2019-11-22 13:33:56 -06:00
Casey Rodarmor
d2decbfdb8
Resolve functions (#550)
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
ba93c5e6af
Remove unnecessary type argument to Alias (#549) 2019-11-21 10:14:55 -06:00
Casey Rodarmor
4f08bb4d77
Resolve alias targets (#548)
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 (#547)
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
72bc85e4ea
Un-implement Deref for Table (#546)
Remove `Deref` implementation for `Table`, to make sure we're using
`Table` and not `BTreeMap`.
2019-11-20 16:19:49 -06:00
Casey Rodarmor
e5232fda89
Release v0.5.1 (#544)
- Bump version: v0.5.0 -> v0.5.1
- Update changelog
2019-11-20 02:08:58 -06:00
Casey Rodarmor
e948f11784
Add --init subcommand (#541)
When `--init` is passed on the command line, search upward for the
project root, identified by the presence of a VCS directory like `.git`,
falling back to the current directory, and create a default justfile in
that directory.
2019-11-20 01:07:44 -06:00
Casey Rodarmor
c4e9857ebd
Avoid fs::canonicalize (#539)
Previously, we used `fs::canonicalize` to ensure paths used in search
were absolute. This lead to bad behavior when the justfile was symbolic
link to a file in another directory. Additionally, on Windows, this
produced paths in extended length syntax, which, I believe, has
compatibility issues.

This diff replaces uses of `fs::canonicalize`  with a simpler algorithm
that roots path in the invocation directory (which will be a no-op if
said path is already absolute), uses `Path::components` to remove extra
`/` and `.`, and resolves instances of `..` without following symlinks, by
removing the `..` and the component that proceeds it.
2019-11-19 03:51:44 -08:00
Casey Rodarmor
f8693d6fe0
Move lexer comment (#536) 2019-11-13 19:53:14 -08:00
Casey Rodarmor
598f1c3200
Refactor Compilation error to contain a Token (#535)
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
c40d16f2a2
Release: v0.5.0 (#530)
- Bump version: v0.4.5 -> v0.5.0
- Update dependencies
- Update changelog
- Appease linter
- Appease clippy
2019-11-12 14:11:53 -08:00
Casey Rodarmor
e80bf34d9a
Add shell setting (#525)
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 (#523)
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
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
8279361b39
Move subcommand execution into Subcommand (#514)
Moves the code which executes subcommands into Subcommand:run,
delegating to separate functions for each subcommand. This reduces the
disgustingness of `run::run` a bit, and paves the way for future
refactoring and cleanup.
2019-11-07 13:52:22 -08:00
Casey Rodarmor
33ba66dbb6
Move cd out of Config::from_matches (#513)
Move `env::set_current_dir` outside of `Config::from_matches()` and into
`run()`. It's a bit cleaner this way, and sets us up to make the just
process not change its own directory at all, instead explicitly changing
the working directory of its child processes.
2019-11-07 13:29:17 -08:00
Casey Rodarmor
2ff33de5a1
Highlight echoed recipe lines in bold by default (#512)
Make `--highlight`, which highlights echoed recipe lines in bold, the
default behavior. Add `--no-highlight` to activate the old behavior.
2019-11-07 11:50:11 -08:00
Casey Rodarmor
36aca2bf7a
Remove now-unnecessary borrow checker appeasement (#511)
Borrow errors produced by an older version of rust forced us to create
copies of errors in the recipe resolver. The borrow checker appears to
have evolved to the point where these copies are unnecessary, so this
diff removes them.
2019-11-07 11:24:08 -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
f3b8030070
Bump version: v0.4.4 -> v0.4.5 (#505) 2019-10-31 19:19:01 -07:00
Casey Rodarmor
48b25c14b1
Use constants instead of literals in arg parser (#504)
- Differentiate between `arg`s, which are flags and options, and `cmd`s,
  which are mutually exclusive subcommands

- Replace string literals, like "EVALUATE", with constants, like
  `cmd::EVALUATE`, since they're slightly less error prone.

- Remove `Config::evaluate`, and handle it like other subcommands
2019-10-31 17:39:25 -07:00
Casey Rodarmor
c26c0e4ecc
Update dependencies (#501)
- dotenv: 0.13 -> 0.15 (picks up the new parser)
- ansi-term: 0.11 -> 0.12
- env_logger: 0.6 -> 0.7
2019-10-22 19:51:50 -07: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
750ba6eb57
Remove unused use statements (#497) 2019-10-16 03:15:59 -07:00
Casey Rodarmor
3de31b3c02
Remove misc.rs (#491)
Put everything that was in `misc.rs` into their own files, with some opportunistic
refactoring, because why not.
2019-10-09 01:40:40 -07:00
Casey Rodarmor
ca4f2a44ed
Refactor run::run and Config (#490)
Improve color parsing, add `ConfigError`, put `invocation_directory` on Config object, return error code from `run::run` instead of exiting.
2019-10-09 00:18:53 -07:00
Casey Rodarmor
ab11740104
Add explicit Subcommand enum (#484) 2019-10-07 04:04:39 -07:00
Casey Rodarmor
2938ab1561
Start pulling argument parsing out of run::run() (#483)
run::run() is pretty unwieldy. As a first step in improving it, this
commit pulls most of the argument parsing into the `config` module.

It also renames `Configuration` to `Config`, just to be easier to type.
2019-10-07 02:06:45 -07:00
Casey Rodarmor
2818d4da1c
Fix summary feature conditional compilation (#475)
The correct syntax is `#[cfg(feature = "summary")]`.
2019-09-23 18:52:27 -07:00
Casey Rodarmor
1d063cce01
Hide summary functionality behind feature flag (#472)
Since summaries are only used by Janus, the Just ecosystem testing tool,
it makes sense to hide it behind a feature flag.
2019-09-21 19:19:56 -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
1cb90f4e65
Use pub(crate) instead of pub (#471)
Eventually, there will probably be a `crate` visibility specifier that
does the same thing as `pub(crate)`. This commit replaces `pub` with
`pub(crate)`, so when `crate` is available we can easily switch to it.
2019-09-21 15:35:03 -07:00
Casey Rodarmor
1d3235780a
Make comments in common.rs lowercase (#470) 2019-09-15 01:29:11 +02: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
Casey Rodarmor
04a2b6461e
Generate man page with help2man (#463)
The generated man page doesn't look great by default, so this also adds the
help4help2man feature, which makes Just print a help message that produces
a better man page.
2019-07-18 21:58:06 -07:00
Casey Rodarmor
74e45e7c05
Remove dependency on brev (#462)
Just's dependency on brev was the cause of a
fairly deep branch of the transitive dependency
tree. To decrease build time and make the life of
packagers easier, this diff moves the functionality
that Just was using in Brev into Just itself, and
removes the dependency on Brev.

Fortunately, the only functionality that Just was
using was the output function and OutputError
enum, so this was easily done.
2019-07-13 01:55:06 -07:00
Niklas Claesson
ff91e3d7c6 Use tempfile crate instead of tempdir (#455) 2019-07-06 20:55:46 -07:00
Light Ning
a4556241de Update deprecated rust range patterns and clippy config (#450)
- Fix warning: `...` range patterns are deprecated
- Update deprecated cyclomatic-complexity-threshold to cognitive-complexity-threshold
2019-06-06 23:34:07 -07:00
Rostyslav Shevtsiv
7f06bc68d4 Ignore file name case while searching for justfile (#436) 2019-06-01 22:38:02 -07:00
Casey Rodarmor
9b08ce6fd8
Display alias target with --show (#443) 2019-05-15 15:43:47 -04:00
Casey Rodarmor
fdb5c4f578
Typo: "command equivelant" -> "command equivalent" (#418) 2019-04-19 14:18:24 -07:00
Casey Rodarmor
fce4c232d3
Remove write_token_error_context (#417) 2019-04-19 04:07:29 -07:00
Casey Rodarmor
9c82a1e329
Move CompilationErrorKind into separate module (#416) 2019-04-19 02:40:25 -07:00
Casey Rodarmor
415c84ea39
Refactor and rename test macros (#415) 2019-04-19 02:17:43 -07:00
Casey Rodarmor
d065d1c54f
Lexer code deduplication and refactoring (#414) 2019-04-18 13:12:38 -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
85336f09b0
Bump version: v0.4.1 -> v0.4.2 (#407) 2019-04-15 23:39:18 -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
a2e55ef40e
Make summary function non-generic (#404) 2019-04-15 13:21:35 -07:00
Casey Rodarmor
c3d1d9049f
Bump version: 0.3.13 -> 0.4.0 (#401) 2019-04-12 00:46:29 -07:00
Casey Rodarmor
fe0a6c252c
Allow arbitrary expressions as default arguments (#400) 2019-04-11 23:58:08 -07:00
Casey Rodarmor
12f9428695
Add justfile summaries (#399)
Exposes an interface for producing a summary that captures the important details of the parsed justfile.
2019-04-11 16:35:16 -07:00