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

[#52] Adds a generate command for a default .tools.toml file #62

Closed MitchellBerend closed 1 year ago

MitchellBerend commented 1 year ago

Resolves #52.

The generate command also uses the --config flag to set the location of the generated file. Would it be a good idea to have some output when actually generating the config? Right now there is no actual response unless there is some file system error.

$ cargo run -- --config test-tools.toml generate
   Compiling tool-sync v0.1.0 (/home/mitchell/rust/tool-sync)
    Finished dev [unoptimized + debuginfo] target(s) in 2.14s
     Running `target/debug/tool --config test-tools.toml generate``

$ cat test-tools.toml 
# This file was automatically generated by tool-sync
#
#store_directory = "$HOME/.tools.toml"
#
#    [bat]
#        owner =     "sharkdp"
#        repo =      "bat"
#        exe_name =  "bat"
#        tag =       "latest"
#    [exa]
#        owner =     "ogham"
#        repo =      "exa"
#        exe_name =  "exa"
#        tag =       "latest"
#    [fd]
#        owner =     "sharkdp"
#        repo =      "fd"
#        exe_name =  "fd"
#        tag =       "latest"
#    [ripgrep]
#        owner =     "BurntSushi"
#        repo =      "ripgrep"
#        exe_name =  "rg"
#        tag =       "latest"
MitchellBerend commented 1 year ago

We should wait for the discussion in #65 to be resolved since this issue might constitute changes in this pr

MitchellBerend commented 1 year ago

The file that currently gets generated looks like this

$ cat test-tools.toml 
# This file was automatically generated by tool-sync
#
# The directory to store all tools in
#store_directory = "$HOME/.local/bin"
#
#[ripgrep]
#   owner     = "BurntSushi"
#   repo      = "ripgrep"
#   exe_name  = "rg"
#
#   # Uncomment to download a specific version or tag.
#   # Without this tag latest will be used
#   # tag       = "latest"
#
#
# Asset name to download on linux OSes
#asset_name.linux = "x86_64-unknown-linux-musl"
#
# uncomment if you want to install on macOS as well
#asset_name.macos = "apple-darwin"
#
# uncomment if you want to install on Windows as well
#asset_name.windows = "x86_64-pc-windows-msvc"

Is this missing anything?

MitchellBerend commented 1 year ago

Issues that can be created following this pr The first 2 could maybe all get the tag `good-first-issue


We can do some magic in a build.rs file that can generate the src/config/template.rs so it contains the version in the config template itself.


chshersh commented 1 year ago

@MitchellBerend These new issues look like a good improvement over the existing state of affairs 👍🏻 I'm thinking about a completely alternative design for the config-related commands (e.g. maybe it would be better to have the tool config --default command and other flags to the config command?) so I'll create an RFC soon and I'd like to invite you to the discussion. And when it's decided what interface is better, we can continue with other improvements around configs 🚢

chshersh commented 1 year ago

I've created an issue to discuss the future interface of all config-related commands: