aefdcea7d0
- 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.
73 lines
2.7 KiB
Rust
73 lines
2.7 KiB
Rust
// stdlib
|
|
pub(crate) use std::{
|
|
borrow::Cow,
|
|
cmp,
|
|
collections::{BTreeMap, BTreeSet},
|
|
env,
|
|
fmt::{self, Display, Formatter},
|
|
fs,
|
|
io::{self, Write},
|
|
iter::{self, FromIterator},
|
|
ops::{Deref, Range, RangeInclusive},
|
|
path::{Path, PathBuf},
|
|
process::{self, Command},
|
|
str::{self, Chars},
|
|
sync::{Mutex, MutexGuard},
|
|
usize, vec,
|
|
};
|
|
|
|
// modules used in tests
|
|
#[cfg(test)]
|
|
pub(crate) use crate::testing;
|
|
|
|
// structs and enums used in tests
|
|
#[cfg(test)]
|
|
pub(crate) use crate::{node::Node, tree::Tree};
|
|
|
|
// dependencies
|
|
pub(crate) use edit_distance::edit_distance;
|
|
pub(crate) use libc::EXIT_FAILURE;
|
|
pub(crate) use log::warn;
|
|
pub(crate) use snafu::{ResultExt, Snafu};
|
|
pub(crate) use unicode_width::UnicodeWidthChar;
|
|
|
|
// modules
|
|
pub(crate) use crate::{config_error, keyword, search_error};
|
|
|
|
// functions
|
|
pub(crate) use crate::{
|
|
default::default, empty::empty, load_dotenv::load_dotenv, output::output,
|
|
write_message_context::write_message_context,
|
|
};
|
|
|
|
// traits
|
|
pub(crate) use crate::{
|
|
command_ext::CommandExt, compilation_result_ext::CompilationResultExt, error::Error,
|
|
error_result_ext::ErrorResultExt, keyed::Keyed, ordinal::Ordinal,
|
|
platform_interface::PlatformInterface, range_ext::RangeExt,
|
|
};
|
|
|
|
// structs and enums
|
|
pub(crate) use crate::{
|
|
alias::Alias, alias_resolver::AliasResolver, analyzer::Analyzer, assignment::Assignment,
|
|
assignment_evaluator::AssignmentEvaluator, assignment_resolver::AssignmentResolver, color::Color,
|
|
compilation_error::CompilationError, compilation_error_kind::CompilationErrorKind,
|
|
compiler::Compiler, config::Config, config_error::ConfigError, count::Count,
|
|
enclosure::Enclosure, expression::Expression, fragment::Fragment, function::Function,
|
|
function_context::FunctionContext, functions::Functions, interrupt_guard::InterruptGuard,
|
|
interrupt_handler::InterruptHandler, item::Item, justfile::Justfile, lexer::Lexer, line::Line,
|
|
list::List, load_error::LoadError, module::Module, name::Name, output_error::OutputError,
|
|
parameter::Parameter, parser::Parser, platform::Platform, position::Position, recipe::Recipe,
|
|
recipe_context::RecipeContext, recipe_resolver::RecipeResolver, runtime_error::RuntimeError,
|
|
search::Search, search_config::SearchConfig, search_error::SearchError, shebang::Shebang,
|
|
show_whitespace::ShowWhitespace, state::State, string_literal::StringLiteral,
|
|
subcommand::Subcommand, table::Table, token::Token, token_kind::TokenKind, use_color::UseColor,
|
|
variables::Variables, verbosity::Verbosity, warning::Warning,
|
|
};
|
|
|
|
// type aliases
|
|
pub(crate) type CompilationResult<'a, T> = Result<T, CompilationError<'a>>;
|
|
pub(crate) type ConfigResult<T> = Result<T, ConfigError>;
|
|
pub(crate) type RunResult<'a, T> = Result<T, RuntimeError<'a>>;
|
|
pub(crate) type SearchResult<T> = Result<T, SearchError>;
|