2019-09-14 16:29:11 -07:00
|
|
|
// stdlib
|
2019-04-11 15:23:14 -07:00
|
|
|
pub(crate) use std::{
|
|
|
|
cmp,
|
|
|
|
collections::{BTreeMap, BTreeSet},
|
|
|
|
env,
|
2021-05-09 20:35:35 -07:00
|
|
|
ffi::{OsStr, OsString},
|
2019-11-21 10:14:10 -08:00
|
|
|
fmt::{self, Debug, Display, Formatter},
|
2019-11-07 10:55:15 -08:00
|
|
|
fs,
|
2020-03-14 21:41:57 -07:00
|
|
|
io::{self, Cursor, Write},
|
2019-11-07 10:55:15 -08:00
|
|
|
iter::{self, FromIterator},
|
2019-11-20 14:19:49 -08:00
|
|
|
ops::{Index, Range, RangeInclusive},
|
2019-04-11 15:23:14 -07:00
|
|
|
path::{Path, PathBuf},
|
2020-09-17 19:43:04 -07:00
|
|
|
process::{self, Command, Stdio},
|
2019-11-21 06:23:32 -08:00
|
|
|
rc::Rc,
|
2019-10-31 17:39:25 -07:00
|
|
|
str::{self, Chars},
|
2019-04-11 15:23:14 -07:00
|
|
|
sync::{Mutex, MutexGuard},
|
|
|
|
usize, vec,
|
|
|
|
};
|
2018-03-17 09:17:41 -07:00
|
|
|
|
2019-09-14 16:29:11 -07:00
|
|
|
// dependencies
|
2019-11-21 10:14:10 -08:00
|
|
|
pub(crate) use derivative::Derivative;
|
2019-04-11 15:23:14 -07:00
|
|
|
pub(crate) use edit_distance::edit_distance;
|
2019-10-09 00:18:53 -07:00
|
|
|
pub(crate) use libc::EXIT_FAILURE;
|
2020-03-31 00:00:05 -07:00
|
|
|
pub(crate) use log::{info, warn};
|
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
|
|
|
pub(crate) use snafu::{ResultExt, Snafu};
|
2020-10-26 18:16:42 -07:00
|
|
|
pub(crate) use strum::{Display, EnumString, IntoStaticStr};
|
2020-08-21 15:13:54 -07:00
|
|
|
pub(crate) use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
|
2018-03-17 09:17:41 -07:00
|
|
|
|
2019-09-14 16:29:11 -07:00
|
|
|
// modules
|
2020-10-26 18:16:42 -07:00
|
|
|
pub(crate) use crate::{config_error, setting};
|
2019-07-06 20:55:46 -07:00
|
|
|
|
2019-09-14 16:29:11 -07:00
|
|
|
// functions
|
2021-04-05 21:28:37 -07:00
|
|
|
pub(crate) use crate::{
|
|
|
|
default::default, empty::empty, load_dotenv::load_dotenv, output::output, unindent::unindent,
|
|
|
|
};
|
2019-06-01 22:38:03 -07:00
|
|
|
|
2019-11-07 10:55:15 -08:00
|
|
|
// traits
|
2019-06-01 22:38:03 -07:00
|
|
|
pub(crate) use crate::{
|
2020-10-25 19:37:26 -07:00
|
|
|
command_ext::CommandExt, error::Error, error_result_ext::ErrorResultExt, keyed::Keyed,
|
|
|
|
ordinal::Ordinal, platform_interface::PlatformInterface, range_ext::RangeExt,
|
2019-04-11 15:23:14 -07:00
|
|
|
};
|
|
|
|
|
2019-11-07 10:55:15 -08:00
|
|
|
// structs and enums
|
|
|
|
pub(crate) use crate::{
|
2019-11-21 07:39:32 -08:00
|
|
|
alias::Alias, analyzer::Analyzer, assignment::Assignment,
|
2019-12-07 03:09:21 -08:00
|
|
|
assignment_resolver::AssignmentResolver, binding::Binding, color::Color,
|
2019-11-07 10:55:15 -08:00
|
|
|
compilation_error::CompilationError, compilation_error_kind::CompilationErrorKind,
|
|
|
|
compiler::Compiler, config::Config, config_error::ConfigError, count::Count,
|
2020-10-27 23:51:17 -07:00
|
|
|
delimiter::Delimiter, dependency::Dependency, enclosure::Enclosure, evaluator::Evaluator,
|
|
|
|
expression::Expression, fragment::Fragment, function::Function,
|
|
|
|
function_context::FunctionContext, interrupt_guard::InterruptGuard,
|
|
|
|
interrupt_handler::InterruptHandler, item::Item, justfile::Justfile, keyword::Keyword,
|
|
|
|
lexer::Lexer, line::Line, list::List, load_error::LoadError, module::Module, name::Name,
|
|
|
|
output_error::OutputError, parameter::Parameter, parameter_kind::ParameterKind, parser::Parser,
|
|
|
|
platform::Platform, position::Position, positional::Positional, recipe::Recipe,
|
|
|
|
recipe_context::RecipeContext, recipe_resolver::RecipeResolver, runtime_error::RuntimeError,
|
|
|
|
scope::Scope, search::Search, search_config::SearchConfig, search_error::SearchError, set::Set,
|
|
|
|
setting::Setting, settings::Settings, shebang::Shebang, show_whitespace::ShowWhitespace,
|
2021-04-04 16:41:02 -07:00
|
|
|
string_kind::StringKind, string_literal::StringLiteral, subcommand::Subcommand,
|
|
|
|
suggestion::Suggestion, table::Table, thunk::Thunk, token::Token, token_kind::TokenKind,
|
|
|
|
unresolved_dependency::UnresolvedDependency, unresolved_recipe::UnresolvedRecipe,
|
|
|
|
use_color::UseColor, variables::Variables, verbosity::Verbosity, warning::Warning,
|
2019-11-07 10:55:15 -08:00
|
|
|
};
|
2019-04-19 02:40:25 -07:00
|
|
|
|
2019-11-07 10:55:15 -08:00
|
|
|
// type aliases
|
|
|
|
pub(crate) type CompilationResult<'a, T> = Result<T, CompilationError<'a>>;
|
2019-10-09 00:18:53 -07:00
|
|
|
pub(crate) type ConfigResult<T> = Result<T, ConfigError>;
|
2019-11-07 10:55:15 -08:00
|
|
|
pub(crate) type RunResult<'a, T> = Result<T, RuntimeError<'a>>;
|
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
|
|
|
pub(crate) type SearchResult<T> = Result<T, SearchError>;
|
2020-10-05 17:58:30 -07:00
|
|
|
|
|
|
|
// 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};
|