diff --git a/Cargo.lock b/Cargo.lock index ea6f002..3f89401 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,18 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -11,6 +23,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "anstream" version = "0.6.4" @@ -250,7 +268,7 @@ dependencies = [ [[package]] name = "dotree" -version = "0.5.0" +version = "0.5.1" dependencies = [ "anyhow", "clap", @@ -258,6 +276,7 @@ dependencies = [ "ctrlc", "dirs", "exec", + "hashbrown", "k9", "log", "once_cell", @@ -375,6 +394,16 @@ dependencies = [ "wasi", ] +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "heck" version = "0.4.1" @@ -989,3 +1018,23 @@ name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "zerocopy" +version = "0.7.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] diff --git a/Cargo.toml b/Cargo.toml index 03ccc4c..bb30c89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dotree" -version = "0.5.0" +version = "0.5.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -19,6 +19,7 @@ clap = { version = "4.4.6", features = ["derive"] } console = "0.15.7" ctrlc = "3.4.1" dirs = "5.0.1" +hashbrown = "0.14.2" log = "0.4.20" once_cell = "1.18.0" pest = "2.7.4" diff --git a/mk-release.bash b/mk-release.bash index 58921ff..3a4a6a4 100755 --- a/mk-release.bash +++ b/mk-release.bash @@ -6,10 +6,12 @@ pkg_id="$(cargo pkgid)" tag=${pkg_id##*#} cargo test + cargo build --release --target=x86_64-unknown-linux-musl strip target/x86_64-unknown-linux-musl/release/dt cargo build --release --target=x86_64-pc-windows-gnu +strip target/x86_64-pc-windows-gnu/release/dt.exe gh release create "$tag"\ --draft diff --git a/src/core.rs b/src/core.rs index 8951f5e..45e3398 100644 --- a/src/core.rs +++ b/src/core.rs @@ -7,7 +7,7 @@ use rustyline::{Completer, Helper, Hinter, Validator}; use std::env; use std::io::Write; use std::path::PathBuf; -use std::process::{exit, Stdio}; +use std::process::Stdio; use std::{fs, io}; use crate::outproxy::OutProxy; @@ -165,7 +165,7 @@ fn exec_cmd<'a>(shell_name: &'a str, mut args: Vec<&'a str>) -> Result<()> { fn exec_cmd(shell_name: &str, args: Vec<&str>) -> Result<()> { // windows doesn't have an exec, let's do this instead run_subcommand(shell_name, &args, false)?; - exit(0); + std::process::exit(0); } fn run_subcommand(prog: &str, args: &[&str], ignore_result: bool) -> Result<()> { diff --git a/src/parser.rs b/src/parser.rs index 9243dfc..4d90194 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,4 +1,5 @@ -use std::collections::{HashMap, VecDeque}; +use hashbrown::HashMap; +use std::collections::VecDeque; use pest::{ iterators::{Pair, Pairs}, @@ -430,25 +431,25 @@ mod tests { display_name: None, entries: { [ - 'h', + 'c', ]: Command( Command { - exec_str: "echo hi", + exec_str: "echo ciao", settings: [], - name: Some( - "print hi", - ), + name: None, shell: None, env_vars: [], }, ), [ - 'c', + 'h', ]: Command( Command { - exec_str: "echo ciao", + exec_str: "echo hi", settings: [], - name: None, + name: Some( + "print hi", + ), shell: None, env_vars: [], },