devmatteini / dra

A command line tool to download release assets from GitHub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support GLOB patterns

ZanzyTHEbar opened this issue · comments

I am not sure if you do support GLOB patterns - but i am having trouble using this binary to grab a specific release asset using GLOB patterns - like i can using gh cli. I have a project where i would like to embed this binary for easy, and lightweight, grabbing of a specific release asset. The issue is that the release asset to grab is user-configured. As in the user supplies a string to be able to grab the asset - each asset however has a name that changes based on the version and target.

In the gh cli - this is functional

gh -R lorow/OpenIris release download -p "workspace-v*-esp32Cam*.zip"

This would grab the binary for the specific target board.

How can i achieve the same thing with your project :)

Note: dra untag does not work - i've tried. It just gives me the asset name in full, it doesn't allow any type of pattern usage.

Hi and thanks for checking out dra!

As you pointed out, dra untag doesn't work as you expected, but it did behave correctly.
If I run dra untag lorow/OpenIris this is the output:

❯ dra untag lorow/OpenIris
Release tag is v1.10.6
✔ Pick the asset to untag · workspace-v1.10.5-esp32Cam-fafd35d-master.zip
workspace-v1.10.5-esp32Cam-fafd35d-master.zip

If you look closely, the release tag is v1.10.6, but the release asset has v1.10.5 in the name.
Unfortunately, there's nothing dra can do in this case. The release assets have been created with the wrong release version in the name.

How can i achieve the same thing with your project :)

The first thing to point out is that dra can only download one release asset at the time (the gh cli command you pasted download every asset that matches that pattern).
If that's not a problem for you can do:

$ dra untag lorow/OpenIris
workspace-v{tag}-esp32Cam-fafd35d-master.zip

$ dra download -s "workspace-v{tag}-esp32Cam-fafd35d-master.zip" lorow/OpenIris

understood, thank you. In order to use your tools I'll have to fix the version discrepancy, and remove the revision number from the name. That way I can grab a release by predictable name and simple untag the version.

Appreciate the quick response, great work. Very nice project. Saved me a lot of time 😅

I'm glad it was helpful!

I'll close this issue, if you have any problem feel free to create another issue/discussion 😄

i am not sure i should create another issue for this (let me know if that is your preferred approach)- but i have one more question related to this topic.

I would like to automate the untagging process so that our users can select the release asset from a dropdown menu in the GUI and in the backend it calls the download command by passing a string to the command. I have the binary embedding and the passing of the command handled.

Is there a way to avoid having to select an asset using the untagging command, or do i just have to keep track of the most recent version (somehow) and then call the download command directly by formatting the string with the version?

Is there a way to avoid having to select an asset using the untagging command, or do i just have to keep track of the most recent version (somehow) and then call the download command directly by formatting the string with the version?

Do you mean selecting manually? If yes, at the moment manually is the only way to do it.
I guess you would want to do something like this, for example:

$ dra untag devmatteini/dra-tests --tag 0.1.5 --select helloworld_0.1.5.tar.gz
helloworld_{tag}.tar.gz