From bcde05bfd236446fb9e4df8219f26908261eb1e5 Mon Sep 17 00:00:00 2001 From: Dom Slee Date: Tue, 11 Apr 2023 21:48:48 +1000 Subject: [PATCH] rename binary from `tabcomplete` to `posh-tabcomplete` (#9) * update deps * rename tabcomplete --> posh-tabcomplete --- .github/workflows/release.yml | 8 +- Cargo.lock | 142 +++++++++++++++++----------------- Cargo.toml | 10 +-- README.md | 6 +- benchmark/benchmark_all.ps1 | 4 +- resource/init.ps1 | 6 +- tests/test_testenv.rs | 6 +- tests/testenv/mod.rs | 4 +- 8 files changed, 90 insertions(+), 96 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76035c0..755789d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,15 +74,15 @@ jobs: run: > tar -cv README.md - -C target/${{ matrix.target }}/release/ tabcomplete + -C target/${{ matrix.target }}/release/ posh-tabcomplete | gzip --best - > 'tabcomplete-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz' + > 'posh-tabcomplete-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz' - name: Package (Windows) if: runner.os == 'Windows' run: > - 7z a 'tabcomplete-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.zip' + 7z a 'posh-tabcomplete-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.zip' README.md - ./target/${{ matrix.target }}/release/tabcomplete.exe + ./target/${{ matrix.target }}/release/posh-tabcomplete.exe - name: Upload artifact uses: actions/upload-artifact@v2 diff --git a/Cargo.lock b/Cargo.lock index c4cf305..7d983c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -352,9 +352,9 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa48fa079165080f11d7753fd0bc175b7d391f276b965fe4b55bfad67856e463" +checksum = "cf9cc2b23599e6d7479755f3594285efb3f74a1bdca7a7374948bc831e23a552" dependencies = [ "chrono", "chrono-tz-build", @@ -416,7 +416,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -528,9 +528,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -649,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4056f63fce3b82d852c3da92b08ea59959890813a7f4ce9c0ff85b10cf301b" dependencies = [ "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -676,7 +676,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -693,14 +693,14 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] name = "dialoguer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af3c796f3b0b408d9fd581611b47fa850821fcb84aa640b83a3c1a5be2d691f2" +checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" dependencies = [ "console", "shell-words", @@ -811,13 +811,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -863,13 +863,13 @@ dependencies = [ [[package]] name = "fd-lock" -version = "3.0.11" +version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9799aefb4a2e4a01cc47610b1dd47c18ab13d991f27bbcaed9296f5a53d5cbad" +checksum = "39ae6b3d9530211fb3b12a95374b8b0823be812f53d09e18c5675c0146b09642" dependencies = [ "cfg-if 1.0.0", - "rustix 0.37.6", - "windows-sys 0.45.0", + "rustix 0.37.11", + "windows-sys 0.48.0", ] [[package]] @@ -883,14 +883,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.16", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1030,7 +1030,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -1090,9 +1090,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1107,7 +1107,7 @@ checksum = "e77ac7b51b8e6313251737fcef4b1c01a2ea102bde68415b62c0ee9268fec357" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -1193,16 +1193,16 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.54" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.46.0", + "windows 0.48.0", ] [[package]] @@ -1295,13 +1295,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1325,14 +1325,14 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.6", - "windows-sys 0.45.0", + "rustix 0.37.11", + "windows-sys 0.48.0", ] [[package]] @@ -1420,9 +1420,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "libloading" @@ -1583,7 +1583,7 @@ checksum = "8842972f23939443013dfd3720f46772b743e86f1a81d120d4b6fb090f87de1c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -2049,7 +2049,7 @@ checksum = "09846ef8a8da6b74d172bcf57f3e7d6b47d01be82c1a7bf9f8e9d34fa86a083b" dependencies = [ "atty", "chrono", - "errno 0.3.0", + "errno 0.3.1", "libc", "libproc", "log", @@ -2237,9 +2237,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.49" +version = "0.10.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" +checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2258,7 +2258,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -2269,9 +2269,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.84" +version = "0.9.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" +checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0" dependencies = [ "cc", "libc", @@ -2508,7 +2508,7 @@ dependencies = [ "flate2", "hex", "lazy_static", - "rustix 0.36.11", + "rustix 0.36.12", ] [[package]] @@ -2803,12 +2803,12 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.11" +version = "0.36.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" +checksum = "e0af200a3324fa5bcd922e84e9b55a298ea9f431a489f01961acdebc6e908f25" dependencies = [ "bitflags", - "errno 0.2.8", + "errno 0.3.1", "io-lifetimes", "libc", "linux-raw-sys 0.1.4", @@ -2817,16 +2817,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.6" +version = "0.37.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" dependencies = [ "bitflags", - "errno 0.3.0", + "errno 0.3.1", "io-lifetimes", "libc", "linux-raw-sys 0.3.1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2902,22 +2902,22 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -2954,9 +2954,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.19" +version = "0.9.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" +checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c" dependencies = [ "indexmap", "itoa", @@ -3146,9 +3146,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" dependencies = [ "proc-macro2", "quote", @@ -3217,7 +3217,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.6", + "rustix 0.37.11", "windows-sys 0.45.0", ] @@ -3246,7 +3246,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.37.6", + "rustix 0.37.11", "windows-sys 0.48.0", ] @@ -3278,7 +3278,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -3431,7 +3431,7 @@ checksum = "bb01b60fcc3f5e17babb1a9956263f3ccd2cadc3e52908400231441683283c1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.14", ] [[package]] @@ -3503,9 +3503,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c" +checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6" [[package]] name = "ureq" @@ -3569,9 +3569,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "5b55a3fef2a1e3b3a00ce878640918820d3c51081576ac657d23af9fc7928fdb" dependencies = [ "getrandom", ] @@ -3767,11 +3767,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.46.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.42.2", + "windows-targets 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 134cb60..81b81d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,14 +7,6 @@ description = "Blazing fast tab completion for powershell." repository = "https://github.com/domsleee/posh-tabcomplete" readme = "README.md" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/{ version }/{ name }-{ version }-{ target }.{ archive-format }" -pkg-fmt = "tgz" - -[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] -pkg-fmt = "zip" - [dependencies] clap = { version = "4.1.8", features = ["derive"] } itertools = "0.10.5" @@ -37,7 +29,7 @@ rstest_reuse = "0.5.0" speculoos = "0.11.0" [[bin]] -name = "tabcomplete" +name = "posh-tabcomplete" path = "src/main.rs" [profile.release] diff --git a/README.md b/README.md index c28c2af..8d47e54 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ There are binaries available in [releases](https://github.com/domsleee/posh-tabc Add this line to your profile, you can edit this by typing `code $PROFILE` in powershell: ```pwsh -Invoke-Expression (&tabcomplete init | Out-String) +Invoke-Expression (&posh-tabcomplete init | Out-String) ``` [crates.io]: https://crates.io/crates/starship @@ -44,8 +44,8 @@ To run these, run `./benchmark/benchmark_all.ps1` Benchmark | Results ----------|----------- -`benchmark/init` - startup time | tabcomplete: 102ms, posh-git: 432ms (4.24x faster) -`benchmark/complete` - tab completion (100 branches) | tabcomplete: 71ms, posh-git: 172ms (2.42x faster) +`benchmark/init` - startup time | posh-tabcomplete: 102ms, posh-git: 432ms (4.24x faster) +`benchmark/complete` - tab completion (100 branches) | posh-tabcomplete: 71ms, posh-git: 172ms (2.42x faster) ## Aliases / Function support Functions are supported. For example, the completion of `gco` in the demo is: diff --git a/benchmark/benchmark_all.ps1 b/benchmark/benchmark_all.ps1 index 09a7129..cf4e9ee 100644 --- a/benchmark/benchmark_all.ps1 +++ b/benchmark/benchmark_all.ps1 @@ -8,7 +8,7 @@ pwsh -Command { Write-Output "binary path $binaryPath" $sep = if ($env:OS -eq "Windows_NT") { ';' } else { ':' } $env:PATH = "$binaryPath$sep$env:PATH" - $actualBinaryDirectory = $(Split-Path $(Get-Command tabcomplete).Path) + $actualBinaryDirectory = $(Split-Path $(Get-Command posh-tabcomplete).Path) if ($actualBinaryDirectory -ne $binaryPath) { Write-Error "Mismatch, expected $binaryPath, got $actualBinaryDirectory" exit 1 @@ -16,7 +16,7 @@ pwsh -Command { $allBenchmarksFile = "$scriptRoot/all.md" Write-Output "# All results`n" > $allBenchmarksFile - $fileSize = $(Get-Item $(Get-Command tabcomplete).Path).Length + $fileSize = $(Get-Item $(Get-Command posh-tabcomplete).Path).Length Write-Output "file size: $fileSize" Write-Output "file size: $fileSize" >> $allBenchmarksFile diff --git a/resource/init.ps1 b/resource/init.ps1 index 58bb036..5c5b975 100644 --- a/resource/init.ps1 +++ b/resource/init.ps1 @@ -1,11 +1,11 @@ #!/usr/bin/env pwsh $ErrorActionPreference = "stop" -$null = New-Module tabcomplete { +$null = New-Module posh-tabcomplete { function Get-JoinPattern($executables) { "($($executables -join '|'))" } $EnableProxyFunctionExpansion = $true - $knownExecutables = @(&tabcomplete nu-commands)#"git", "burrito" + $knownExecutables = @(&posh-tabcomplete nu-commands)#"git", "burrito" $GitProxyFunctionRegex = "(^|[;`n])(\s*)(?$(Get-JoinPattern $knownExecutables))(?(([^\S\r\n]|[^\S\r\n]``\r?\n)+\S+)*)(([^\S\r\n]|[^\S\r\n]``\r?\n)+\`$args)(\s|``\r?\n)*($|[|;`n])" function Main { @@ -24,7 +24,7 @@ $null = New-Module tabcomplete { if ($EnableProxyFunctionExpansion) { $textToComplete = Expand-GitProxyFunctionForComplete($textToComplete) } - $null | &tabcomplete complete "$textToComplete" + $null | &posh-tabcomplete complete "$textToComplete" } # Below is for alias expansion diff --git a/tests/test_testenv.rs b/tests/test_testenv.rs index 05a5fbd..77de327 100644 --- a/tests/test_testenv.rs +++ b/tests/test_testenv.rs @@ -7,7 +7,9 @@ pub use testenv::*; #[test] pub fn test_path_is_set() { let testenv = TestEnv::new("pwsh"); - let res = testenv.run_with_profile("(gcm tabcomplete).Path").unwrap(); + let res = testenv + .run_with_profile("(gcm posh-tabcomplete).Path") + .unwrap(); let lines = res.stdout.lines().map(|x| x.unwrap()).collect_vec(); let bin_invoked_path = fs::canonicalize(&lines[0]).expect("invoked path"); @@ -19,7 +21,7 @@ pub fn test_path_is_set() { .parent() .expect("rootdirectory"); let expected_bin_path = project_path.join("target").join("debug").join(format!( - "tabcomplete{}", + "posh-tabcomplete{}", if cfg!(windows) { ".exe" } else { "" } )); diff --git a/tests/testenv/mod.rs b/tests/testenv/mod.rs index 43abced..5876039 100644 --- a/tests/testenv/mod.rs +++ b/tests/testenv/mod.rs @@ -123,7 +123,7 @@ fn create_working_dir(profile_prefix_data: Vec<&str>) -> Result<(TempDir, PathBu println!("root: {root:?}"); let mut init_str = profile_prefix_data.join("\n\n"); init_str.push('\n'); - init_str.push_str("Invoke-Expression (&tabcomplete init | Out-String)"); + init_str.push_str("Invoke-Expression (&posh-tabcomplete init | Out-String)"); let profile_path = root.join("tabcompleteProfile.ps1"); fs::File::create(&profile_path)?.write_all(init_str.as_bytes())?; @@ -154,7 +154,7 @@ fn create_working_dir(profile_prefix_data: Vec<&str>) -> Result<(TempDir, PathBu } fn debug_target_dir() -> PathBuf { - // Tests exe is in target/debug/deps, tabcomplete.exe is in `target` + // Tests exe is in target/debug/deps, posh-tabcomplete.exe is in `target` let target_dir = env::current_exe() .expect("tests executable") .parent()