2021-09-16 07:51:45 -07:00
|
|
|
#![deny(clippy::all, clippy::pedantic)]
|
2020-01-15 02:16:13 -08:00
|
|
|
#![allow(
|
|
|
|
clippy::enum_glob_use,
|
2023-05-27 17:42:52 -07:00
|
|
|
clippy::let_underscore_untyped,
|
2020-01-15 02:16:13 -08:00
|
|
|
clippy::needless_pass_by_value,
|
2023-11-24 23:15:41 -08:00
|
|
|
clippy::similar_names,
|
2020-01-15 02:30:24 -08:00
|
|
|
clippy::too_many_lines,
|
2023-06-12 09:53:55 -07:00
|
|
|
clippy::unnecessary_wraps,
|
2020-04-26 14:19:21 -07:00
|
|
|
clippy::wildcard_imports
|
2020-01-15 02:16:13 -08:00
|
|
|
)]
|
|
|
|
|
2022-06-18 21:56:31 -07:00
|
|
|
pub(crate) use {
|
|
|
|
crate::{
|
|
|
|
alias::Alias, analyzer::Analyzer, assignment::Assignment,
|
2022-10-25 16:32:36 -07:00
|
|
|
assignment_resolver::AssignmentResolver, ast::Ast, attribute::Attribute, binding::Binding,
|
2023-11-21 11:28:59 -08:00
|
|
|
color::Color, color_display::ColorDisplay, command_ext::CommandExt, compilation::Compilation,
|
2023-01-26 19:03:04 -08:00
|
|
|
compile_error::CompileError, compile_error_kind::CompileErrorKind, compiler::Compiler,
|
2022-10-25 16:32:36 -07:00
|
|
|
conditional_operator::ConditionalOperator, config::Config, config_error::ConfigError,
|
|
|
|
count::Count, delimiter::Delimiter, dependency::Dependency, dump_format::DumpFormat,
|
|
|
|
enclosure::Enclosure, error::Error, evaluator::Evaluator, expression::Expression,
|
|
|
|
fragment::Fragment, function::Function, function_context::FunctionContext,
|
|
|
|
interrupt_guard::InterruptGuard, interrupt_handler::InterruptHandler, item::Item,
|
|
|
|
justfile::Justfile, keyed::Keyed, keyword::Keyword, lexer::Lexer, line::Line, list::List,
|
|
|
|
load_dotenv::load_dotenv, loader::Loader, name::Name, ordinal::Ordinal, output::output,
|
|
|
|
output_error::OutputError, parameter::Parameter, parameter_kind::ParameterKind, parser::Parser,
|
|
|
|
platform::Platform, platform_interface::PlatformInterface, position::Position,
|
|
|
|
positional::Positional, range_ext::RangeExt, recipe::Recipe, recipe_context::RecipeContext,
|
2022-06-18 21:56:31 -07:00
|
|
|
recipe_resolver::RecipeResolver, scope::Scope, search::Search, search_config::SearchConfig,
|
|
|
|
search_error::SearchError, set::Set, setting::Setting, settings::Settings, shebang::Shebang,
|
|
|
|
shell::Shell, 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,
|
|
|
|
},
|
|
|
|
std::{
|
|
|
|
cmp,
|
2023-11-21 11:28:59 -08:00
|
|
|
collections::{BTreeMap, BTreeSet, HashMap},
|
2022-06-18 21:56:31 -07:00
|
|
|
env,
|
|
|
|
ffi::{OsStr, OsString},
|
|
|
|
fmt::{self, Debug, Display, Formatter},
|
|
|
|
fs,
|
|
|
|
io::{self, Cursor, Write},
|
|
|
|
iter::{self, FromIterator},
|
|
|
|
mem,
|
|
|
|
ops::{Index, Range, RangeInclusive},
|
|
|
|
path::{self, Path, PathBuf},
|
|
|
|
process::{self, Command, ExitStatus, Stdio},
|
|
|
|
rc::Rc,
|
|
|
|
str::{self, Chars},
|
|
|
|
sync::{Mutex, MutexGuard},
|
2023-10-16 20:07:09 -07:00
|
|
|
vec,
|
2022-06-18 21:56:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
camino::Utf8Path,
|
|
|
|
derivative::Derivative,
|
|
|
|
edit_distance::edit_distance,
|
|
|
|
lexiclean::Lexiclean,
|
|
|
|
libc::EXIT_FAILURE,
|
|
|
|
log::{info, warn},
|
|
|
|
regex::Regex,
|
|
|
|
serde::{
|
|
|
|
ser::{SerializeMap, SerializeSeq},
|
|
|
|
Serialize, Serializer,
|
|
|
|
},
|
|
|
|
snafu::{ResultExt, Snafu},
|
|
|
|
strum::{Display, EnumString, IntoStaticStr},
|
|
|
|
typed_arena::Arena,
|
|
|
|
unicode_width::{UnicodeWidthChar, UnicodeWidthStr},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
pub(crate) use crate::{node::Node, tree::Tree};
|
|
|
|
|
2021-11-17 00:07:48 -08:00
|
|
|
pub use crate::run::run;
|
|
|
|
|
|
|
|
// Used in integration tests.
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub use unindent::unindent;
|
|
|
|
|
2022-06-18 21:56:31 -07:00
|
|
|
pub(crate) type CompileResult<'a, T> = Result<T, CompileError<'a>>;
|
|
|
|
pub(crate) type ConfigResult<T> = Result<T, ConfigError>;
|
|
|
|
pub(crate) type RunResult<'a, T> = Result<T, Error<'a>>;
|
|
|
|
pub(crate) type SearchResult<T> = Result<T, SearchError>;
|
|
|
|
|
2018-10-13 03:12:35 -07:00
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
2019-11-07 10:55:15 -08:00
|
|
|
pub mod testing;
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
|
|
|
pub mod tree;
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
pub mod node;
|
2018-10-13 03:12:35 -07:00
|
|
|
|
|
|
|
#[cfg(fuzzing)]
|
2022-06-20 19:16:02 -07:00
|
|
|
pub mod fuzzing;
|
2018-10-13 03:12:35 -07:00
|
|
|
|
2021-11-17 00:07:48 -08:00
|
|
|
// Used by Janus, https://github.com/casey/janus, a tool
|
|
|
|
// that analyses all public justfiles on GitHub to avoid
|
|
|
|
// breaking changes.
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub mod summary;
|
|
|
|
|
2019-04-11 12:30:29 -07:00
|
|
|
mod alias;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod analyzer;
|
|
|
|
mod assignment;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod assignment_resolver;
|
2021-07-23 20:26:27 -07:00
|
|
|
mod ast;
|
2022-10-25 16:32:36 -07:00
|
|
|
mod attribute;
|
2019-12-07 03:09:21 -08:00
|
|
|
mod binding;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod color;
|
2021-07-28 18:06:57 -07:00
|
|
|
mod color_display;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod command_ext;
|
2023-11-21 11:28:59 -08:00
|
|
|
mod compilation;
|
2021-07-26 01:26:06 -07:00
|
|
|
mod compile_error;
|
|
|
|
mod compile_error_kind;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod compiler;
|
2021-07-26 17:19:52 -07:00
|
|
|
mod completions;
|
2021-09-16 16:45:56 -07:00
|
|
|
mod conditional_operator;
|
2019-10-07 02:06:45 -07:00
|
|
|
mod config;
|
2019-10-09 00:18:53 -07:00
|
|
|
mod config_error;
|
2019-10-09 01:40:40 -07:00
|
|
|
mod count;
|
2020-10-27 23:51:17 -07:00
|
|
|
mod delimiter;
|
2019-11-21 06:23:32 -08:00
|
|
|
mod dependency;
|
2021-11-17 00:07:48 -08:00
|
|
|
mod dump_format;
|
2019-10-09 01:40:40 -07:00
|
|
|
mod enclosure;
|
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
|
|
|
mod error;
|
2019-12-07 03:09:21 -08:00
|
|
|
mod evaluator;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod expression;
|
|
|
|
mod fragment;
|
|
|
|
mod function;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod function_context;
|
|
|
|
mod interrupt_guard;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod interrupt_handler;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod item;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod justfile;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod keyed;
|
|
|
|
mod keyword;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod lexer;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod line;
|
2019-10-09 01:40:40 -07:00
|
|
|
mod list;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod load_dotenv;
|
2021-07-26 01:26:06 -07:00
|
|
|
mod loader;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod name;
|
2019-04-19 02:17:43 -07:00
|
|
|
mod ordinal;
|
2019-07-13 01:55:06 -07:00
|
|
|
mod output;
|
|
|
|
mod output_error;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod parameter;
|
2020-06-13 01:49:13 -07:00
|
|
|
mod parameter_kind;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod parser;
|
|
|
|
mod platform;
|
2019-07-13 01:55:06 -07:00
|
|
|
mod platform_interface;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod position;
|
Reform positional argument parsing (#523)
This diff makes positional argument parsing much cleaner, along with
adding a bunch of tests. Just's positional argument parsing is rather,
complex, so hopefully this reform allows it to both be correct and stay
correct.
User-visible changes:
- `just ..` is now accepted, with the same effect as `just ../`
- `just .` is also accepted, with the same effect as `just`
- It is now an error to pass arguments or overrides to subcommands
that do not accept them, namely `--dump`, `--edit`, `--list`,
`--show`, and `--summary`. It is also an error to pass arguments to
`--evaluate`, although `--evaluate` does of course still accept
overrides.
(This is a breaking change, but hopefully worth it, as it will allow us
to add arguments to subcommands which did not previously take
them, if we so desire.)
- Subcommands which do not accept arguments may now accept a
single search-directory argument, so `just --list ../` and
`just --dump foo/` are now accepted, with the former starting the
search for the justfile to list in the parent directory, and the latter
starting the search for the justfile to dump in `foo`.
2019-11-10 18:02:36 -08:00
|
|
|
mod positional;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod range_ext;
|
|
|
|
mod recipe;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod recipe_context;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod recipe_resolver;
|
|
|
|
mod run;
|
2019-12-07 03:09:21 -08:00
|
|
|
mod scope;
|
2019-06-01 22:38:03 -07:00
|
|
|
mod search;
|
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
|
|
|
mod search_config;
|
2019-06-01 22:38:03 -07:00
|
|
|
mod search_error;
|
2019-11-10 23:17:47 -08:00
|
|
|
mod set;
|
|
|
|
mod setting;
|
|
|
|
mod settings;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod shebang;
|
2022-05-31 13:01:59 -07:00
|
|
|
mod shell;
|
2019-10-09 01:40:40 -07:00
|
|
|
mod show_whitespace;
|
2021-04-04 16:41:02 -07:00
|
|
|
mod string_kind;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod string_literal;
|
2019-10-07 04:04:39 -07:00
|
|
|
mod subcommand;
|
2020-04-26 14:19:21 -07:00
|
|
|
mod suggestion;
|
2019-11-07 10:55:15 -08:00
|
|
|
mod table;
|
2019-11-21 10:14:10 -08:00
|
|
|
mod thunk;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod token;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod token_kind;
|
2021-04-05 21:28:37 -07:00
|
|
|
mod unindent;
|
2019-12-07 04:03:03 -08:00
|
|
|
mod unresolved_dependency;
|
|
|
|
mod unresolved_recipe;
|
2019-04-15 22:40:02 -07:00
|
|
|
mod use_color;
|
|
|
|
mod variables;
|
2018-10-13 03:12:35 -07:00
|
|
|
mod verbosity;
|
2019-09-21 18:53:30 -07:00
|
|
|
mod warning;
|