pub_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 use {
8  crate::{
9    alias::Alias, analyzer::Analyzer, argument_parser::ArgumentParser, assignment::Assignment,
10    assignment_resolver::AssignmentResolver, ast::Ast, attribute::Attribute, binding::Binding,
11    color::Color, color_display::ColorDisplay, command_color::CommandColor,
12    command_ext::CommandExt, compilation::Compilation, compile_error::CompileError,
13    compile_error_kind::CompileErrorKind, compiler::Compiler, condition::Condition,
14    conditional_operator::ConditionalOperator, config::Config, config_error::ConfigError,
15    constants::constants, count::Count, delimiter::Delimiter, dependency::Dependency,
16    dump_format::DumpFormat, enclosure::Enclosure, error::Error, evaluator::Evaluator,
17    execution_context::ExecutionContext, executor::Executor, expression::Expression,
18    fragment::Fragment, function::Function, interpreter::Interpreter,
19    interrupt_guard::InterruptGuard, interrupt_handler::InterruptHandler, item::Item,
20    justfile::Justfile, keyed::Keyed, keyword::Keyword, lexer::Lexer, line::Line, list::List,
21    load_dotenv::load_dotenv, loader::Loader, module_path::ModulePath, name::Name,
22    namepath::Namepath, ordinal::Ordinal, output::output, output_error::OutputError,
23    parameter::Parameter, parameter_kind::ParameterKind, parser::Parser, platform::Platform,
24    platform_interface::PlatformInterface, position::Position, positional::Positional, ran::Ran,
25    range_ext::RangeExt, recipe::Recipe, recipe_resolver::RecipeResolver,
26    recipe_signature::RecipeSignature, scope::Scope, search::Search, search_config::SearchConfig,
27    search_error::SearchError, set::Set, setting::Setting, settings::Settings, shebang::Shebang,
28    show_whitespace::ShowWhitespace, source::Source, string_delimiter::StringDelimiter,
29    string_kind::StringKind, string_literal::StringLiteral, subcommand::Subcommand,
30    suggestion::Suggestion, table::Table, thunk::Thunk, token::Token, token_kind::TokenKind,
31    unresolved_dependency::UnresolvedDependency, unresolved_recipe::UnresolvedRecipe,
32    unstable_feature::UnstableFeature, use_color::UseColor, variables::Variables,
33    verbosity::Verbosity, warning::Warning,
34  },
35  camino::Utf8Path,
36  clap::ValueEnum,
37  derive_where::derive_where,
38  edit_distance::edit_distance,
39  lexiclean::Lexiclean,
40  libc::EXIT_FAILURE,
41  once_cell::sync::Lazy,
42  regex::Regex,
43  serde::{
44    ser::{SerializeMap, SerializeSeq},
45    Serialize, Serializer,
46  },
47  snafu::{ResultExt, Snafu},
48  std::{
49    borrow::Cow,
50    cmp,
51    collections::{BTreeMap, BTreeSet, HashMap, HashSet},
52    env,
53    ffi::OsString,
54    fmt::{self, Debug, Display, Formatter},
55    fs,
56    io::{self, Read, Seek, Write},
57    iter::{self, FromIterator},
58    mem,
59    ops::Deref,
60    ops::{Index, Range, RangeInclusive},
61    path::{self, Path, PathBuf},
62    process::{self, Command, ExitStatus, Stdio},
63    rc::Rc,
64    str::{self, Chars},
65    sync::{Mutex, MutexGuard, OnceLock},
66    vec,
67  },
68  strum::{Display, EnumDiscriminants, EnumString, IntoStaticStr},
69  tempfile::tempfile,
70  typed_arena::Arena,
71  unicode_width::{UnicodeWidthChar, UnicodeWidthStr},
72};
73
74#[cfg(test)]
75pub use crate::{node::Node, tree::Tree};
76
77pub use crate::run::run;
78
79// Used in integration tests.
80#[doc(hidden)]
81pub use unindent::unindent;
82
83type CompileResult<'a, T = ()> = Result<T, CompileError<'a>>;
84type ConfigResult<T> = Result<T, ConfigError>;
85type FunctionResult = Result<String, String>;
86pub type RunResult<'a, T = ()> = Result<T, Error<'a>>;
87type SearchResult<T> = Result<T, SearchError>;
88
89#[cfg(test)]
90#[macro_use]
91pub mod testing;
92
93#[cfg(test)]
94#[macro_use]
95pub mod tree;
96
97#[cfg(test)]
98pub mod node;
99
100#[cfg(fuzzing)]
101pub mod fuzzing;
102
103// Used by Janus, https://github.com/casey/janus, a tool
104// that analyses all public justfiles on GitHub to avoid
105// breaking changes.
106#[doc(hidden)]
107pub mod summary;
108
109pub mod alias;
110pub mod analyzer;
111pub mod argument_parser;
112pub mod assignment;
113pub mod assignment_resolver;
114pub mod ast;
115pub mod attribute;
116pub mod binding;
117pub mod color;
118pub mod color_display;
119pub mod command_color;
120pub mod command_ext;
121pub mod compilation;
122pub mod compile_error;
123pub mod compile_error_kind;
124pub mod compiler;
125pub mod completions;
126pub mod condition;
127pub mod conditional_operator;
128pub mod config;
129pub mod config_error;
130pub mod constants;
131pub mod count;
132pub mod delimiter;
133pub mod dependency;
134pub mod dump_format;
135pub mod enclosure;
136pub mod error;
137pub mod evaluator;
138pub mod execution_context;
139pub mod executor;
140pub mod expression;
141pub mod fragment;
142pub mod function;
143pub mod interpreter;
144pub mod interrupt_guard;
145pub mod interrupt_handler;
146pub mod item;
147pub mod justfile;
148pub mod keyed;
149pub mod keyword;
150pub mod lexer;
151pub mod line;
152pub mod list;
153pub mod load_dotenv;
154pub mod loader;
155pub mod module_path;
156pub mod name;
157pub mod namepath;
158pub mod ordinal;
159pub mod output;
160pub mod output_error;
161pub mod parameter;
162pub mod parameter_kind;
163pub mod parser;
164pub mod platform;
165pub mod platform_interface;
166pub mod position;
167pub mod positional;
168pub mod ran;
169pub mod range_ext;
170pub mod recipe;
171pub mod recipe_resolver;
172pub mod recipe_signature;
173pub mod run;
174pub mod scope;
175pub mod search;
176pub mod search_config;
177pub mod search_error;
178pub mod set;
179pub mod setting;
180pub mod settings;
181pub mod shebang;
182pub mod show_whitespace;
183pub mod source;
184pub mod string_delimiter;
185pub mod string_kind;
186pub mod string_literal;
187pub mod subcommand;
188pub mod suggestion;
189pub mod table;
190pub mod thunk;
191pub mod token;
192pub mod token_kind;
193pub mod unindent;
194pub mod unresolved_dependency;
195pub mod unresolved_recipe;
196pub mod unstable_feature;
197pub mod use_color;
198pub mod variables;
199pub mod verbosity;
200pub mod warning;