Commit Graph

4 Commits

Author SHA1 Message Date
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
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
ab11740104
Add explicit Subcommand enum (#484) 2019-10-07 04:04:39 -07:00