devmatteini / dra

A command line tool to download release assets from GitHub
MIT License
185 stars 8 forks source link

Feature Request: Installing raw binary downloads to its real name (e.g. jq) #226

Closed sandreas closed 2 months ago

sandreas commented 2 months ago

Hey there,

dra is now almost perfect for my use case, thanks again for the improvements. A minor detail has shown up when using dra to install raw binaries like jq:

dra download -a jqlang/jq -I jq --output /home/sandreas/bin/

will install /home/sandreas/bin/jq-linux-amd64 instead of /home/sandreas/bin/jq, so I think if you have a raw binary download and provide -I, dra should move the resulting binary to the name that has been provided via -I... in this case

jq-linux-amd64 -> jq

Would that be correct? Otherwise the -I has no purpose on raw binary downloads because there is nothing to search for...

devmatteini commented 2 months ago

Hi @sandreas!

dra is now almost perfect for my use case, thanks again for the improvements

Awesome :tada:, I'm really happy about it!

will install /home/sandreas/bin/jq-linux-amd64 instead of /home/sandreas/bin/jq, so I think if you have a raw binary download and provide -I, dra should move the resulting binary to the name that has been provided via -I...

The -I/--istall-file can only be used with tar/zip archives, otherwise is treated as the default installation used by -i/--install flag.

To solve your issue, you can use -o/--output option:

dra download -a jqlang/jq -i --output /home/sandreas/bin/jq
#                         ^~~                            ^~~~
#                         Use default install mode       You specify the filename you want

I took this decision in order to have a consistent API where -o/--output is always available for the user to choose where to save the asset and what name it should have.

I'll improve the documentation to make this more clear for future users. You can also find examples of common scenarios in the docs examples section.

And you can always check dra download --help for this kind of information :smile:

sandreas commented 2 months ago

Thanks for pointing this out.