chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
69 stars 16 forks source link

feature: extract multiple executables #145

Open hdhoang opened 1 year ago

hdhoang commented 1 year ago

hi, nushell comes with some plugins as separate executables:

unzip -l nu-0.69.1-x86_64-pc-windows-msvc.zip
Archive:  nu-0.69.1-x86_64-pc-windows-msvc.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
   341504  09-28-2022 03:19   less.exe
     1115  09-28-2022 02:49   LICENSE
     1065  09-28-2022 03:19   LICENSE-for-less.txt
 41157632  09-28-2022 03:17   nu.exe
  1519616  09-28-2022 03:01   nu_plugin_custom_values.exe
  1507328  09-28-2022 03:01   nu_plugin_example.exe
  2603520  09-28-2022 03:19   nu_plugin_gstat.exe
  1178112  09-28-2022 03:02   nu_plugin_inc.exe
  2316288  09-28-2022 03:02   nu_plugin_query.exe
      127  09-28-2022 02:49   README.txt
---------                     -------
 50626307                     10 files

tar tf nu-0.69.1-x86_64-apple-darwin.tar.gz
LICENSE
README.txt
nu
nu_plugin_custom_values
nu_plugin_example
nu_plugin_gstat
nu_plugin_inc
nu_plugin_query

(let's ignore less.exe for windows)

I suppose we can use usual globbing

exe_name = "nu*"

or additional entries

extra_exe = ["nu_plugin_inc", ...]

or explicit prefix-match

exe_name = "nu"
exe_as_prefix = true

This globbing, the checksum-file ignoring, and (TBD) issue about shellcheck make me think adding glob, is more conventional.

wdyt?

MitchellBerend commented 1 year ago

This is related to #116. In that issue there are multiple hits on tarballs are found and tool can't deal with that (yet). There has not been a decision on how to implement this issue yet either but glob and regex are the currently on the table. I think both of those will also solve this issue.

chshersh commented 1 year ago

I don't expect the list of binaries to be large (e.g. 20+ entries). In that case, I'd propose to support an array of strings in the exe_name field. So, for nushell it could look like this:

exe_name = [
    "nu_plugin_custom_values",
    "nu_plugin_example",
    "nu_plugin_gstat",
    "nu_plugin_inc",
    "nu_plugin_query",
]

The semantics of this is to copy everything that matches any of the strings in the array.

I don't like globs and regexes for this because they have the potential to match and copy lots of unexpected stuff. For binaries, we really want to copy only a few specific files and their names don't change too often.