榆树:如何只获得榆树版本的一行?

elm: how get just one line with the elm version?

如何用elm版本只得到一行?

现在我明白了:

$ elm-make --version
elm-make 0.17 (Elm Platform 0.17.0)

Usage: elm-make [FILES...] [--output FILE] [--yes] [--report FORMAT] [--warn]
                [--docs FILE] [--prepublish] [--prepublish-core]
  build Elm projects

Available options:
  -h,--help                Show this help text
  --output FILE            Write result to the given .html or .js FILE.
  --yes                    Reply 'yes' to all automated prompts.
  --report FORMAT          Format of error and warning reports (e.g.
                           --report=json)
  --warn                   Report warnings to improve code quality.
  --docs FILE              Write documentation to FILE as JSON.

Examples:
  elm-make Main.elm                     # compile to HTML in index.html
  elm-make Main.elm --output main.html  # compile to HTML in main.html
  elm-make Main.elm --output elm.js     # compile to JS in elm.js
  elm-make Main.elm --warn              # compile and report warnings

Full guide to using elm-make at <https://github.com/elm-lang/elm-make>
$
elm-make --version 2>&1 | head -n 1

不确定重定向是否绝对必要;在这种情况下,一些工具只是打印到标准输出。

Elm 平台中的其他两个工具只打印版本(至少对我来说 OSX Elm 0.17.0):

% elm reactor --version
0.17.0
% elm repl --version
0.17.0

从版本 0.18.0 开始,普通 elm 工具有效:

$ elm --version
0.18.0