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