Commit Graph

21 Commits

Author SHA1 Message Date
Casey Rodarmor
27cd8fd554
Remove call to sed in justfile (#1078) 2022-01-30 20:16:10 +00:00
Casey Rodarmor
09af9bb5e5
Change MSRV to 1.46.0 (#968) 2021-09-16 14:51:45 +00:00
Casey Rodarmor
629c75ff04
Use stable rustfmt instead of nightly (#967) 2021-09-16 13:44:40 +00:00
Casey Rodarmor
9c3bbc9fa7
Support .justfile as an alternative to justfile (#931) 2021-07-31 19:25:49 +00:00
Casey Rodarmor
d797592365
Remove test-utilities crate (#892) 2021-07-03 21:26:59 +00:00
Casey Rodarmor
7bc9d3986e
Fix bang lexing and placate clippy (#821) 2021-05-07 00:14:38 -07:00
Casey Rodarmor
3ec7dea4a3
Use unstable rustfmt configuration options (#592) 2020-02-10 20:07:06 -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
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
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
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
750ba6eb57
Remove unused use statements (#497) 2019-10-16 03:15:59 -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
Niklas Claesson
ff91e3d7c6 Use tempfile crate instead of tempdir (#455) 2019-07-06 20:55:46 -07:00
Rostyslav Shevtsiv
7f06bc68d4 Ignore file name case while searching for justfile (#436) 2019-06-01 22:38:02 -07:00
Casey Rodarmor
2b6b715528
Refactor Everything (#250) 2017-11-16 23:30:08 -08:00
Casey Rodarmor
4a35c14024 Set up cross platform continuous integration on travis (#191)
Gets travis cross platform testing working.

Based on the templates from:

japaric/trust/commit/29b0e084ff2c40d1aa1b6a5d66ab81eca90439e1
2017-05-07 22:48:07 -04:00
Casey Rodarmor
b0c5fa23ee Multi shell integration tests (#181)
* Run integration tests on multiple shells

To make sure that I don't break tests for shells other than my
dev-box's `sh` and the `sh` on travis, each integration test case
now runs using `sh`, `dash`, and `bash.
2017-04-22 16:15:15 -07:00