just/
lib.rs

1//! `just` is primarily used as a command-line binary, but does provide a
2//! limited public library interface.
3//!
4//! Please keep in mind that there are no semantic version guarantees for the
5//! library interface. It may break or change at any time.
6
7pub(crate) use {
8  crate::{
9    alias::Alias,
10    alias_style::AliasStyle,
11    analyzer::Analyzer,
12    argument_parser::ArgumentParser,
13    assignment::Assignment,
14    assignment_resolver::AssignmentResolver,
15    ast::Ast,
16    attribute::{Attribute, AttributeDiscriminant},
17    attribute_set::AttributeSet,
18    binding::Binding,
19    color::Color,
20    color_display::ColorDisplay,
21    command_color::CommandColor,
22    command_ext::CommandExt,
23    compilation::Compilation,
24    compile_error::CompileError,
25    compile_error_kind::CompileErrorKind,
26    compiler::Compiler,
27    condition::Condition,
28    conditional_operator::ConditionalOperator,
29    config::Config,
30    config_error::ConfigError,
31    constants::constants,
32    count::Count,
33    delimiter::Delimiter,
34    dependency::Dependency,
35    dump_format::DumpFormat,
36    enclosure::Enclosure,
37    error::Error,
38    evaluator::Evaluator,
39    execution_context::ExecutionContext,
40    executor::Executor,
41    expression::Expression,
42    fragment::Fragment,
43    function::Function,
44    interpreter::Interpreter,
45    item::Item,
46    justfile::Justfile,
47    keyed::Keyed,
48    keyword::Keyword,
49    lexer::Lexer,
50    line::Line,
51    list::List,
52    load_dotenv::load_dotenv,
53    loader::Loader,
54    module_path::ModulePath,
55    name::Name,
56    namepath::Namepath,
57    ordinal::Ordinal,
58    output_error::OutputError,
59    parameter::Parameter,
60    parameter_kind::ParameterKind,
61    parser::Parser,
62    platform::Platform,
63    platform_interface::PlatformInterface,
64    position::Position,
65    positional::Positional,
66    ran::Ran,
67    range_ext::RangeExt,
68    recipe::Recipe,
69    recipe_resolver::RecipeResolver,
70    recipe_signature::RecipeSignature,
71    scope::Scope,
72    search::Search,
73    search_config::SearchConfig,
74    search_error::SearchError,
75    set::Set,
76    setting::Setting,
77    settings::Settings,
78    shebang::Shebang,
79    show_whitespace::ShowWhitespace,
80    signal::Signal,
81    signal_handler::SignalHandler,
82    source::Source,
83    string_delimiter::StringDelimiter,
84    string_kind::StringKind,
85    string_literal::StringLiteral,
86    subcommand::Subcommand,
87    suggestion::Suggestion,
88    table::Table,
89    thunk::Thunk,
90    token::Token,
91    token_kind::TokenKind,
92    unresolved_dependency::UnresolvedDependency,
93    unresolved_recipe::UnresolvedRecipe,
94    unstable_feature::UnstableFeature,
95    use_color::UseColor,
96    variables::Variables,
97    verbosity::Verbosity,
98    warning::Warning,
99    which::which,
100  },
101  camino::Utf8Path,
102  clap::ValueEnum,
103  derive_where::derive_where,
104  edit_distance::edit_distance,
105  lexiclean::Lexiclean,
106  libc::EXIT_FAILURE,
107  rand::seq::IndexedRandom,
108  regex::Regex,
109  serde::{
110    ser::{SerializeMap, SerializeSeq},
111    Deserialize, Serialize, Serializer,
112  },
113  snafu::{ResultExt, Snafu},
114  std::{
115    borrow::Cow,
116    cmp,
117    collections::{BTreeMap, BTreeSet, HashMap, HashSet},
118    env,
119    ffi::OsString,
120    fmt::{self, Debug, Display, Formatter},
121    fs,
122    io::{self, Write},
123    iter::{self, FromIterator},
124    mem,
125    ops::Deref,
126    ops::{Index, Range, RangeInclusive},
127    path::{self, Path, PathBuf},
128    process::{self, Command, ExitStatus, Stdio},
129    str::{self, Chars},
130    sync::{Arc, LazyLock, Mutex, MutexGuard, OnceLock},
131    thread, vec,
132  },
133  strum::{Display, EnumDiscriminants, EnumString, IntoStaticStr},
134  tempfile::TempDir,
135  typed_arena::Arena,
136  unicode_width::{UnicodeWidthChar, UnicodeWidthStr},
137};
138
139#[cfg(test)]
140pub(crate) use {
141  crate::{node::Node, tree::Tree},
142  std::slice,
143};
144
145pub use crate::run::run;
146
147#[doc(hidden)]
148use request::Request;
149
150// Used in integration tests.
151#[doc(hidden)]
152pub use {request::Response, subcommand::INIT_JUSTFILE, unindent::unindent};
153
154type CompileResult<'a, T = ()> = Result<T, CompileError<'a>>;
155type ConfigResult<T> = Result<T, ConfigError>;
156type FunctionResult = Result<String, String>;
157type RunResult<'a, T = ()> = Result<T, Error<'a>>;
158type SearchResult<T> = Result<T, SearchError>;
159
160#[cfg(test)]
161#[macro_use]
162pub mod testing;
163
164#[cfg(test)]
165#[macro_use]
166pub mod tree;
167
168#[cfg(test)]
169pub mod node;
170
171#[cfg(fuzzing)]
172pub mod fuzzing;
173
174// Used by Janus, https://github.com/casey/janus, a tool
175// that analyses all public justfiles on GitHub to avoid
176// breaking changes.
177#[doc(hidden)]
178pub mod summary;
179
180// Used for testing with the `--request` subcommand.
181#[doc(hidden)]
182pub mod request;
183
184mod alias;
185mod alias_style;
186mod analyzer;
187mod argument_parser;
188mod assignment;
189mod assignment_resolver;
190mod ast;
191mod attribute;
192mod attribute_set;
193mod binding;
194mod color;
195mod color_display;
196mod command_color;
197mod command_ext;
198mod compilation;
199mod compile_error;
200mod compile_error_kind;
201mod compiler;
202mod completions;
203mod condition;
204mod conditional_operator;
205mod config;
206mod config_error;
207mod constants;
208mod count;
209mod delimiter;
210mod dependency;
211mod dump_format;
212mod enclosure;
213mod error;
214mod evaluator;
215mod execution_context;
216mod executor;
217mod expression;
218mod fragment;
219mod function;
220mod interpreter;
221mod item;
222mod justfile;
223mod keyed;
224mod keyword;
225mod lexer;
226mod line;
227mod list;
228mod load_dotenv;
229mod loader;
230mod module_path;
231mod name;
232mod namepath;
233mod ordinal;
234mod output_error;
235mod parameter;
236mod parameter_kind;
237mod parser;
238mod platform;
239mod platform_interface;
240mod position;
241mod positional;
242mod ran;
243mod range_ext;
244mod recipe;
245mod recipe_resolver;
246mod recipe_signature;
247mod run;
248mod scope;
249mod search;
250mod search_config;
251mod search_error;
252mod set;
253mod setting;
254mod settings;
255mod shebang;
256mod show_whitespace;
257mod signal;
258mod signal_handler;
259#[cfg(unix)]
260mod signals;
261mod source;
262mod string_delimiter;
263mod string_kind;
264mod string_literal;
265mod subcommand;
266mod suggestion;
267mod table;
268mod thunk;
269mod token;
270mod token_kind;
271mod unindent;
272mod unresolved_dependency;
273mod unresolved_recipe;
274mod unstable_feature;
275mod use_color;
276mod variables;
277mod verbosity;
278mod warning;
279mod which;