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
72 stars 17 forks source link

Install tools from config using 'tool sync <tool-name>' #92

Closed chshersh closed 2 years ago

chshersh commented 2 years ago

Add the string argument to the tool sync command like so:

tool sync xyz

To allow syncing a single tool from the config. Sometimes you just want to update one of the tools to the latest version (or specific tag) and don't want to redownload all the tools but still use the config.

If the tool is not found in the config, suggest using tool install command.

zixuan-x commented 2 years ago

This looks like a fun one and a good opportunity to learn clap, may I take this one?

chshersh commented 2 years ago

@zixuanzhang-x Indeed, this sounds like a good first issue to me 🙂 Feel free to give it a try.

CLI parsers with clap are defined here:

zixuan-x commented 2 years ago

Would it be more convenient to allow users to specify multiple tools they want to sync instead of a single one?

If so, if some tools the user specified are in the config file while others are not, do we sync the tools found in the config and give an error for the rest? Or do we want to just abort without syncing any tool?

chshersh commented 2 years ago

@zixuanzhang-x I don't think we need to go that far 🙂 We already have the TOML configuration that specifies several tools. And it feels like overlapping use-cases. Also, error-reporting may become more complicated when you want to output errors for multiple tools (like, some of them are found in the config and others are not and it becomes messy).

I imagine syncing a single tool when a user knows there's a new version and they only want to update this one particular tool. For example, difftastic v0.34.0 was broken and when I learned that the new version v0.35.0 was released that fixes the problem, I could just run:

tool sync difftastic

And it would sync only a single tool quickly.

If you want to sync multiple tools, it's easier to just run tool sync 🙂

zixuan-x commented 2 years ago

Got it, that make sense.