如何在 mix.exs 中使用带有语义版本控制的 Git 标签?

How to use Git tags with semantic versioning in mix.exs?

背景

我们在 git 中有一个使用标签的私有存储库。在我们的 mix.exs 中,我们有以下内容:

  defp deps do
    [
      { :plug,    "~> 1.0"  },
      { :my_repo, git: "git@github.com:my_company/my_repo.git", tag: "1.0.0"  }
    ]
  end

现在,如果我只想要 :my_repo1.0.0 版本,那很好。 但是,如果我想要与 1.0.0 兼容的任何版本会怎样?原始文档似乎没有为此设置选项标志:

https://hexdocs.pm/mix/Mix.Tasks.Deps.html

问题

这就是 { :plug, "~> 1.0" }, 中正在发生的事情。在这里我说“给出与这个 兼容的任何 1.X 版本”。

我想要 git 回购协议的相同内容。查看 git 文档后,我知道可以使用 -l 命令:

https://git-scm.com/book/en/v2/Git-Basics-Tagging

git tag -l "1.8.5*" 将 return 所有版本与 1.8.5 兼容。

问题

  1. 有没有办法将 -l 选项传递给 mix.exs deps 函数?
  2. 如果没有,我还有什么其他选择?

Is there a way to pass the -l option to the mix.exs deps function?

我不知道。

If not, what other options do I have?

我会向 mix 核心提出 PR,或者只是介绍您自己的 Mix.SCM 实现,以及 existing git and path, that would be an exact copy-paste from Mix.SCM.Git 但允许/硬编码 -l 选项。