mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 04:27:45 +00:00
feat: rename alejandra_engine to alejandra
This commit is contained in:
parent
bd7ca846d5
commit
bc32bd59e0
90 changed files with 41 additions and 41 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -2,11 +2,20 @@
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "alejandra"
|
||||||
|
version = "1.5.0"
|
||||||
|
dependencies = [
|
||||||
|
"mimalloc",
|
||||||
|
"rnix",
|
||||||
|
"rowan",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "alejandra_cli"
|
name = "alejandra_cli"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alejandra_engine",
|
"alejandra",
|
||||||
"atty",
|
"atty",
|
||||||
"clap",
|
"clap",
|
||||||
"indoc",
|
"indoc",
|
||||||
|
@ -16,15 +25,6 @@ dependencies = [
|
||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "alejandra_engine"
|
|
||||||
version = "1.5.0"
|
|
||||||
dependencies = [
|
|
||||||
"mimalloc",
|
|
||||||
"rnix",
|
|
||||||
"rowan",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
@ -142,9 +142,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.9"
|
version = "0.8.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978"
|
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
|
|
@ -29,7 +29,7 @@ steps:
|
||||||
- direnv allow
|
- direnv allow
|
||||||
- eval "$(direnv export bash)"
|
- eval "$(direnv export bash)"
|
||||||
- echo +++ Run tests
|
- echo +++ Run tests
|
||||||
- cd src/alejandra_engine
|
- cd src/alejandra
|
||||||
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
||||||
|
|
||||||
- label: formatting diff
|
- label: formatting diff
|
||||||
|
|
4
front/Cargo.lock
generated
4
front/Cargo.lock
generated
|
@ -3,7 +3,7 @@
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "alejandra_engine"
|
name = "alejandra"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mimalloc",
|
"mimalloc",
|
||||||
|
@ -15,7 +15,7 @@ dependencies = [
|
||||||
name = "alejandra_front"
|
name = "alejandra_front"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alejandra_engine",
|
"alejandra",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wee_alloc",
|
"wee_alloc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[dependencies]
|
[dependencies]
|
||||||
alejandra_engine = { "path" = "../src/alejandra_engine" }
|
alejandra = { "path" = "../src/alejandra" }
|
||||||
console_error_panic_hook = "*"
|
console_error_panic_hook = "*"
|
||||||
wasm-bindgen = "*"
|
wasm-bindgen = "*"
|
||||||
wee_alloc = "*"
|
wee_alloc = "*"
|
||||||
|
|
|
@ -12,5 +12,5 @@ pub fn main() -> Result<(), JsValue> {
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn format(before: String, path: String) -> String {
|
pub fn format(before: String, path: String) -> String {
|
||||||
alejandra_engine::format::in_memory(path, before).1
|
alejandra::format::in_memory(path, before).1
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rnix = "*"
|
rnix = "0"
|
||||||
rowan = "0.12.6" # follows rnix
|
rowan = "0.12.6" # follows rnix
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-musl.dependencies.mimalloc]
|
[target.aarch64-unknown-linux-musl.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[target.armv6l-unknown-linux-musleabihf.dependencies.mimalloc]
|
[target.armv6l-unknown-linux-musleabihf.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[target.armv7l-unknown-linux-musleabihf.dependencies.mimalloc]
|
[target.armv7l-unknown-linux-musleabihf.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[target.i686-unknown-linux-musl.dependencies.mimalloc]
|
[target.i686-unknown-linux-musl.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu.dependencies.mimalloc]
|
[target.x86_64-unknown-linux-gnu.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-musl.dependencies.mimalloc]
|
[target.x86_64-unknown-linux-musl.dependencies.mimalloc]
|
||||||
default-features = false
|
default-features = false
|
||||||
version = "*"
|
version = "0"
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
authors = ["Kevin Amado <kamadorueda@gmail.com>"]
|
authors = ["Kevin Amado <kamadorueda@gmail.com>"]
|
||||||
description = "The Uncompromising Nix Code Formatter"
|
description = "The Uncompromising Nix Code Formatter"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
name = "alejandra_engine"
|
name = "alejandra"
|
||||||
repository = "https://github.com/kamadorueda/alejandra"
|
repository = "https://github.com/kamadorueda/alejandra"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
|
@ -15,7 +15,7 @@ fn cases() {
|
||||||
let path_out = format!("tests/cases/{}/out", case);
|
let path_out = format!("tests/cases/{}/out", case);
|
||||||
let content_in = std::fs::read_to_string(path_in.clone()).unwrap();
|
let content_in = std::fs::read_to_string(path_in.clone()).unwrap();
|
||||||
let content_got =
|
let content_got =
|
||||||
alejandra_engine::format::in_memory(path_in, content_in.clone()).1;
|
alejandra::format::in_memory(path_in, content_in.clone()).1;
|
||||||
|
|
||||||
if should_update {
|
if should_update {
|
||||||
std::fs::File::create(&path_out)
|
std::fs::File::create(&path_out)
|
|
@ -3,7 +3,7 @@ name = "alejandra"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
alejandra_engine = { path = "../alejandra_engine" }
|
alejandra = { path = "../alejandra" }
|
||||||
atty = "*"
|
atty = "*"
|
||||||
clap = "*"
|
clap = "*"
|
||||||
indoc = "*"
|
indoc = "*"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct FormattedPath {
|
pub(crate) struct FormattedPath {
|
||||||
pub path: String,
|
pub path: String,
|
||||||
pub status: alejandra_engine::format::Status,
|
pub status: alejandra::format::Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn parse(args: Vec<String>) -> clap::ArgMatches {
|
pub(crate) fn parse(args: Vec<String>) -> clap::ArgMatches {
|
||||||
clap::Command::new("Alejandra")
|
clap::Command::new("Alejandra")
|
||||||
.about("The Uncompromising Nix Code Formatter.")
|
.about("The Uncompromising Nix Code Formatter.")
|
||||||
.version(alejandra_engine::version::VERSION)
|
.version(alejandra::version::VERSION)
|
||||||
.arg(
|
.arg(
|
||||||
clap::Arg::new("include")
|
clap::Arg::new("include")
|
||||||
.help("Files or directories, or none to format stdin.")
|
.help("Files or directories, or none to format stdin.")
|
||||||
|
@ -78,7 +78,7 @@ pub(crate) fn stdin(quiet: bool) -> FormattedPath {
|
||||||
std::io::stdin().read_to_string(&mut before).unwrap();
|
std::io::stdin().read_to_string(&mut before).unwrap();
|
||||||
|
|
||||||
let (status, data) =
|
let (status, data) =
|
||||||
alejandra_engine::format::in_memory(path.clone(), before.clone());
|
alejandra::format::in_memory(path.clone(), before.clone());
|
||||||
|
|
||||||
print!("{}", data);
|
print!("{}", data);
|
||||||
|
|
||||||
|
@ -100,9 +100,9 @@ pub(crate) fn simple(
|
||||||
.par_iter()
|
.par_iter()
|
||||||
.map(|path| {
|
.map(|path| {
|
||||||
let status =
|
let status =
|
||||||
alejandra_engine::format::in_fs(path.clone(), in_place);
|
alejandra::format::in_fs(path.clone(), in_place);
|
||||||
|
|
||||||
if let alejandra_engine::format::Status::Changed(changed) = status {
|
if let alejandra::format::Status::Changed(changed) = status {
|
||||||
if changed && !quiet {
|
if changed && !quiet {
|
||||||
if in_place {
|
if in_place {
|
||||||
eprintln!("Changed: {}", &path);
|
eprintln!("Changed: {}", &path);
|
||||||
|
@ -172,7 +172,7 @@ pub(crate) fn tui(
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
paths.into_par_iter().for_each_with(sender_paths, |sender, path| {
|
paths.into_par_iter().for_each_with(sender_paths, |sender, path| {
|
||||||
let status =
|
let status =
|
||||||
alejandra_engine::format::in_fs(path.clone(), in_place);
|
alejandra::format::in_fs(path.clone(), in_place);
|
||||||
|
|
||||||
if let Err(error) = sender
|
if let Err(error) = sender
|
||||||
.send(Event::FormattedPath(FormattedPath { path, status }))
|
.send(Event::FormattedPath(FormattedPath { path, status }))
|
||||||
|
@ -197,7 +197,7 @@ pub(crate) fn tui(
|
||||||
match event {
|
match event {
|
||||||
Event::FormattedPath(formatted_path) => {
|
Event::FormattedPath(formatted_path) => {
|
||||||
match &formatted_path.status {
|
match &formatted_path.status {
|
||||||
alejandra_engine::format::Status::Changed(
|
alejandra::format::Status::Changed(
|
||||||
changed,
|
changed,
|
||||||
) => {
|
) => {
|
||||||
if *changed {
|
if *changed {
|
||||||
|
@ -206,7 +206,7 @@ pub(crate) fn tui(
|
||||||
paths_unchanged += 1;
|
paths_unchanged += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alejandra_engine::format::Status::Error(_) => {
|
alejandra::format::Status::Error(_) => {
|
||||||
paths_with_errors += 1;
|
paths_with_errors += 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -250,7 +250,7 @@ pub(crate) fn tui(
|
||||||
.fg(tui::style::Color::Green),
|
.fg(tui::style::Color::Green),
|
||||||
),
|
),
|
||||||
tui::text::Span::raw(" "),
|
tui::text::Span::raw(" "),
|
||||||
tui::text::Span::raw(alejandra_engine::version::VERSION),
|
tui::text::Span::raw(alejandra::version::VERSION),
|
||||||
]),
|
]),
|
||||||
tui::text::Spans::from(vec![tui::text::Span::raw(
|
tui::text::Spans::from(vec![tui::text::Span::raw(
|
||||||
"The Uncompromising Nix Code Formatter",
|
"The Uncompromising Nix Code Formatter",
|
||||||
|
@ -304,7 +304,7 @@ pub(crate) fn tui(
|
||||||
.map(|formatted_path| {
|
.map(|formatted_path| {
|
||||||
tui::text::Spans::from(vec![
|
tui::text::Spans::from(vec![
|
||||||
match formatted_path.status {
|
match formatted_path.status {
|
||||||
alejandra_engine::format::Status::Changed(
|
alejandra::format::Status::Changed(
|
||||||
changed,
|
changed,
|
||||||
) => tui::text::Span::styled(
|
) => tui::text::Span::styled(
|
||||||
if changed {
|
if changed {
|
||||||
|
@ -319,7 +319,7 @@ pub(crate) fn tui(
|
||||||
tui::style::Style::default()
|
tui::style::Style::default()
|
||||||
.fg(tui::style::Color::Green),
|
.fg(tui::style::Color::Green),
|
||||||
),
|
),
|
||||||
alejandra_engine::format::Status::Error(_) => {
|
alejandra::format::Status::Error(_) => {
|
||||||
tui::text::Span::styled(
|
tui::text::Span::styled(
|
||||||
"ERROR ",
|
"ERROR ",
|
||||||
tui::style::Style::default()
|
tui::style::Style::default()
|
||||||
|
@ -389,7 +389,7 @@ pub fn main() -> std::io::Result<()> {
|
||||||
.filter(|formatted_path| {
|
.filter(|formatted_path| {
|
||||||
matches!(
|
matches!(
|
||||||
formatted_path.status,
|
formatted_path.status,
|
||||||
alejandra_engine::format::Status::Error(_)
|
alejandra::format::Status::Error(_)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.count();
|
.count();
|
||||||
|
@ -402,7 +402,7 @@ pub fn main() -> std::io::Result<()> {
|
||||||
if errors >= 2 { "s" } else { "" }
|
if errors >= 2 { "s" } else { "" }
|
||||||
);
|
);
|
||||||
for formatted_path in formatted_paths {
|
for formatted_path in formatted_paths {
|
||||||
if let alejandra_engine::format::Status::Error(error) =
|
if let alejandra::format::Status::Error(error) =
|
||||||
formatted_path.status
|
formatted_path.status
|
||||||
{
|
{
|
||||||
eprintln!(" {}: {}", formatted_path.path, &error);
|
eprintln!(" {}: {}", formatted_path.path, &error);
|
||||||
|
@ -414,7 +414,7 @@ pub fn main() -> std::io::Result<()> {
|
||||||
let changed = formatted_paths
|
let changed = formatted_paths
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|formatted_path| match formatted_path.status {
|
.filter(|formatted_path| match formatted_path.status {
|
||||||
alejandra_engine::format::Status::Changed(changed) => changed,
|
alejandra::format::Status::Changed(changed) => changed,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.count();
|
.count();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue