dvershinin/lastversion

Exclude not working as expected

Aetherinox opened this issue · 3 comments

Project with incorrect version

https://github.com/shiftkey/desktop/releases

To Reproduce

lastversion --exclude armhf --assets "shiftkey/desktop" --filter deb$

Expected behavior
Any releases with armhf should be excluded

Program output

https://github.com/shiftkey/desktop/releases/download/release-3.3.3-linux2/GitHubDesktop-linux-amd64-3.3.3-linux2.deb
https://github.com/shiftkey/desktop/releases/download/release-3.3.3-linux2/GitHubDesktop-linux-arm64-3.3.3-linux2.deb
https://github.com/shiftkey/desktop/releases/download/release-3.3.3-linux2/GitHubDesktop-linux-armhf-3.3.3-linux2.deb

Update -
I don't know if I was using exclude incorrectly, but the only way I could get the filter to work was either to filter out armhf via bash, or to modify the lastversion command to utilize

lastversion --pre --assets $repo --filter "(?:\b|_)(?:amd64|arm64)\b.*\.deb$" )

Which returns the correct list:

https://github.com/shiftkey/desktop/releases/download/release-3.3.3-linux2/GitHubDesktop-linux-amd64-3.3.3-linux2.deb
https://github.com/shiftkey/desktop/releases/download/release-3.3.3-linux2/GitHubDesktop-linux-arm64-3.3.3-linux2.deb

I tried exclude with even regex and nothing would filter out the correct files.

Hello, --exclude filters release tags (affects what is being selected as the last version), and does not exclude assets from the output. I mean, it's not meant for filtering assets. So it does work as expected...

Only --filter will filter assets, you just need one regex like you guessed. This will work as well:

lastversion --assets "shiftkey/desktop" --filter '^(?!.*armhf).*\.deb$'

Ah ok, Good to know. Appreciate the help. I assume with your command, I could add multiple via:

lastversion --assets "shiftkey/desktop" --filter '^(?!.*armhf|arm64).*\.deb$'