Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release files name pattern - scriptable #4146

Closed
4 of 10 tasks
gomesar9 opened this issue Dec 27, 2024 · 1 comment
Closed
4 of 10 tasks

Release files name pattern - scriptable #4146

gomesar9 opened this issue Dec 27, 2024 · 1 comment

Comments

@gomesar9
Copy link

gomesar9 commented Dec 27, 2024

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.57.0 (0476a65)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

Hi all,

I'm automating some installations using Ansible, and many current tools are distributed via GitHub releases. I've noticed that some projects use version-agnostic file names for their release artifacts, which greatly simplifies the process of automating downloads.

This code snippet exemplifies an Ansible task where the download URL can be easily constructed due to stable file names:

    - name: Check latest if any installed
      ansible.builtin.shell: |
        set -o pipefail && curl -s -D- {{ gh_tool_repo }}/releases/latest |
        {{ gh_tool_version_regex }}

    - name: "Download  archive [{{ gh_tool_name }}]"
      ansible.builtin.get_url:
        url: "{{ gh_tool_repo }}/releases/latest/download/{{ gh_tool_download_file_name }}"
        dest: "{{ tmp_dir.path }}/gh_tool.tar.gz"
        mode: "0755"

When file names include the version, it adds complexity to automation scripts, as they need to dynamically determine the latest version before constructing the download URL. This typically involves request a tag into the input variable, and a replace logic.

I would appreciate it if you could evaluate adopting this approach.

Thank you for your time and consideration.

--EDIT:
I also wanted to mention another point related to automation. Having the fzf --version output match the tag format (including the "v" prefix, e.g., v0.50.1, instead of 0.50.1) would further simplify automation scripts that rely on comparing versions. This inconsistency currently requires additional string manipulation. Thank you.

@junegunn
Copy link
Owner

I understand. However, fzf has been around for more than 10 years by now, and I believe there are many automation scripts out there that follow the current scheme, so we can't afford to suddenly change it and break them.

Since you're using the GitHub API to get the latest release information, you should be able to get the download URLs for the assets from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants