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},
|
2021-06-08 01:01:27 -07:00
|
|
|
fs::{self, File},
|
2020-03-14 21:41:57 -07:00
|
|
|
io::{self, Cursor, Write},
|
2019-11-07 10:55:15 -08:00
|
|
|
iter::{self, FromIterator},
|
2021-06-08 01:01:27 -07:00
|
|
|
mem,
|
2019-11-20 14:19:49 -08:00
|
|
|
ops::{Index, Range, RangeInclusive},
|
2019-04-11 15:23:14 -07:00
|
|
|
path::{Path, PathBuf},
|
2021-07-26 01:26:06 -07:00
|
|
|
process::{self, Command, ExitStatus, 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
|
2021-06-17 00:56:09 -07:00
|
|
|
pub(crate) use camino::Utf8Path;
|
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;
|
2021-06-24 23:41:20 -07:00
|
|
|
pub(crate) use lexiclean::Lexiclean;
|
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};
|
2021-07-26 01:26:06 -07:00
|
|
|
pub(crate) use typed_arena::Arena;
|
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
|
2021-07-26 17:19:52 -07:00
|
|
|
pub(crate) use crate::{completions, config, config_error, setting};
|
2019-07-06 20:55:46 -07:00
|
|
|
|
2019-09-14 16:29:11 -07:00
|
|
|
// functions
|
2021-07-19 18:10:35 -07:00
|
|
|
pub(crate) use crate::{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::{
|
2021-07-28 18:06:57 -07:00
|
|
|
color_display::ColorDisplay, command_ext::CommandExt, 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,
|
2021-07-23 20:26:27 -07:00
|
|
|
assignment_resolver::AssignmentResolver, ast::Ast, binding::Binding, color::Color,
|
2021-07-26 01:26:06 -07:00
|
|
|
compile_error::CompileError, compile_error_kind::CompileErrorKind, config::Config,
|
|
|
|
config_error::ConfigError, count::Count, delimiter::Delimiter, dependency::Dependency,
|
|
|
|
enclosure::Enclosure, error::Error, evaluator::Evaluator, expression::Expression,
|
2021-06-08 01:01:27 -07:00
|
|
|
fragment::Fragment, function::Function, function_context::FunctionContext,
|
|
|
|
interrupt_guard::InterruptGuard, interrupt_handler::InterruptHandler, item::Item,
|
2021-07-26 01:26:06 -07:00
|
|
|
justfile::Justfile, keyword::Keyword, lexer::Lexer, line::Line, list::List, loader::Loader,
|
|
|
|
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, scope::Scope, search::Search,
|
2021-06-08 01:01:27 -07:00
|
|
|
search_config::SearchConfig, search_error::SearchError, set::Set, setting::Setting,
|
|
|
|
settings::Settings, shebang::Shebang, show_whitespace::ShowWhitespace, 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
|
2021-07-26 01:26:06 -07:00
|
|
|
pub(crate) type CompileResult<'a, T> = Result<T, CompileError<'a>>;
|
2019-10-09 00:18:53 -07:00
|
|
|
pub(crate) type ConfigResult<T> = Result<T, ConfigError>;
|
2021-07-26 01:26:06 -07:00
|
|
|
pub(crate) type RunResult<'a, T> = Result<T, Error<'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};
|