Commit Graph

39 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
e118051a5c
Omit aliases that begin with _ from --list` (#398) 2019-04-11 15:57:34 -07:00
Casey Rodarmor
3a287b864a
Housekeeping (#394)
- Upgrade to rust 2018
- Update dependencies
- Use BTree{Map,Set} instead of Map and Set
2019-04-11 15:23:14 -07:00
ryloric
f64f07a0cc Add recipe aliases (#390)
Recipe aliases may be defined with `alias f = foo`, allowing recipes to be called by shorter names on the command line.
2019-04-11 12:30:29 -07:00
Casey Rodarmor
cee9ac21e0
Allow --justfile without --working-directory (#392) 2019-04-08 00:54:05 -07:00
Casey Rodarmor
3d67786aaf
Förmatterdämmerung (#346)
Format with rustfmt
2018-12-08 14:29:41 -08:00
Casey Rodarmor
816183b975
Add grandiloquent verbosity level that echos shebang recipes (#348) 2018-08-31 00:04:06 -07:00
Casey Rodarmor
4e6585d391
Slake Clippy's thirst for blood (#347) 2018-08-27 18:36:40 -07:00
Casey Rodarmor
b14d1ec97c
Wait for child processes to finish (#345)
Thanks to @bheisler for the feature request and initial implementation.

Fixes #302
2018-08-27 16:03:52 -07:00
Joshua Warner
cf3fde442f Implement invocation_directory function (#312) 2018-06-19 13:13:21 -04:00
Casey Rodarmor
886220d4cc
Always enable ansi support on windows (#317) 2018-05-06 22:02:17 -04:00
Casey Rodarmor
a3294822c3
Get package name from Cargo.toml (#315) 2018-05-01 17:01:59 -04:00
Casey Rodarmor
70234f6193
Add dotenv integration (#306) 2018-03-05 13:21:35 -08:00
Gaeulbyul
9eac537a01 Enable ANSI support for Windows 10 Console
On Windows 10, console applications must activate ANSI support in order for colors to be supported.
2018-02-16 00:52:00 -08:00
Casey Rodarmor
26098ba609
Bump version: 0.3.4 -> 0.3.5 (#286) 2017-12-11 21:44:45 +01:00
Casey Rodarmor
c5eeb8944e
Align doc-comments in --list output (#273) 2017-12-01 00:03:59 +01:00
Casey Rodarmor
861173581c
Refactor Tokenizer (#260) 2017-11-18 03:36:02 -08:00
Casey Rodarmor
87b2130db0
Use imperative mood in help strings (#256) 2017-11-17 23:59:36 -08:00
Casey Rodarmor
c84a86dd2b
Use uppercase names for arguments (#255) 2017-11-17 23:23:24 -08:00
Casey Rodarmor
7166fa9e6f
Rename options to configuration (#254) 2017-11-17 23:23:02 -08:00
Casey Rodarmor
13a124d659
Refactor some other stuff (#252) 2017-11-17 17:28:06 -08:00
Casey Rodarmor
2b6b715528
Refactor Everything (#250) 2017-11-16 23:30:08 -08:00