Powerful scripting language & Versatile interactive shell
The tagging of 0.19.1 was also not done correctly - the code would still advertise it as 0.19.0 when built. To fix this I tagged 0.19.2 with the correct version information.
0.19.[012] all have the same functionalities, and packagers are advised to package 0.19.2 only. Sorry for the confusion.
Note: The 0.19.0 version was tagged prematurely by mistake, but it has been picked up by some package managers. As a result, the 0.19.0 version is considered to be "skipped" officially. If your package manager provides a 0.19.0 version, it is probably identical to 0.19.1 in functionalities.
Packagers who have already packaged 0.19.0 are still advised to "upgrade" to 0.19.1.
See release notes in https://elv.sh/blog/0.19.1-release-notes.html
println
builtin is now known as echo
, shadowing the external echo
.<s
, <=s
, ==s
, !=s
, >s
and >=s
(#238).is
builtin is the new generic (shallow) equality predicate. The deep equality predicate deepeq
is now known simply as eq
.==
builtin now compares numbers -- == 1 1.0
is true, while == a a
throws an exception. To compare strings, use either ==s
or is
.use
'ing has been removed. All modules must be use
d before use.into-lines
builtin is now known as to-lines
.history
builtin has been removed; use $le:history
instead (#267).peach
command, a parallel version of each
has been added (#244).a:b
module is the file ~/.elvish/a/b.elv
(#249).-time
has been added that shows the time to run a function.-override-wcwidth
has been added to override wcwidth.$le:after-readline
has been added. It is a list of functions to be called just after the line editor completes reading input, with the input as the sole argument.elvish-stub
program has been removed, and elvish now always runs in foreground. As a nice side effect, elvish is go-gettable again.As always, binaries are found on dl.elvish.io.
use
builtin now looks for modules under ~/.elvish/lib
instead of ~/.elvish
.(Experimental features will change before 1.0. All other features might change before 1.0.)
-ifaddr
builtin outputs the IP addresses of this host, along with the network prefix length.{has,search}-external
have been added. The former is a predicate and the latter outputs the searching result and errors when the external cannot be found.le:styled
builtin now accepts textual styles like green
and bg-red
(#301). For instance, this writes haha
with green font and red background: echo (le:styled haha 'green;bg-red')
.fn f { fail f }; f | f
.ls >
and Tab) and some indices (try echo $le:bindg[
and Tab).As always, binaries are on dl.elvish.io.
Almost all the breaking changes are about control structures. If you have scripts written for 0.6 or earlier, you can use fix-for-0.7 to upgrade your scripts automatically.
Control structures used to mimic POSIX shell, but now use curly braces in a Go-like style:
if (eq a a) {
echo foo
} else {
echo bar
}
Note that in the above code, the opening brace {
must:
Appear on the same line with if
. Otherwise it will be considered to be another command, and elvish will complain that if
does not have enough arguments.
Have a space before it. Otherwise it will be parsed as brace expansion (as in echo {a,b}{c,d}
) instead.
The newline after {
can be substituted by a space, so you can write these in one line if you must:
if (eq a a) { echo foo } else { echo bar }
There used to be a special "boolean return value" for functions like ==
or eq
to indicate whether it has succeeded or failed, indicated by â when failure happens. Now they simply output a boolean value $true
or $false
(#319).
The ?(...)
operator used to capture the aforementioned "boolean return value". Use the output capture operator (...)
instead. The ?(...)
operator has been repurposed to capture exceptions.
The if
and while
control structures now take values instead of pipelines (also see #319). Together with 1 and 2, this code
if == $x 1; then
echo 1
else
echo 2
fi
should now be written as
if (== $x 1) {
echo 1
} else {
echo 2
}
The for
control structure has been changed to operate on one iterable value, instead of a bunch of values. The in
keyword is nolonger needed. For example, this code
for x in lorem ipsum; do
echo $x
done
should now be written as
for x [lorem ipsum] {
echo $x
}
The try
control structure is only changed syntactically. This piece of code:
try
do-dangerous-stuff
except e
put $e
else
echo all well
finally
echo finally
tried
is now written as:
try {
do-dangerous-stuff
} except e {
put $e
} except {
echo all well
} finally {
echo finally
}
A but:
glob qualifier has been introduced to exclude results from globbing. For instance, to remove all files in the current directory except parse
, do:
rm -r *[but:parse]
The qualifier only accepts literal file names for now.
This is another pre-release, for no particular reason other than lack of pre-releases for a long time.
As always, binaries are on https://dl.elvish.io.
The unpack
builtin is now known as explode
, for more excitement.
Mode-specific editor commands now reside in mode-specific subnamespaces of le:
(they used to be all directly under le:
). For instance, navigation-related builtins are now to be found in le:nav:
. For example, le:nav-left
has become le:nav:left
.
Names of most builtins undergo a simple mechanical transformation like in the example. Notable exceptions are:
le:start-xxx
builtins that are now le:xxx:start
.
le:navigation-default
is now le:nav:default
, in consistency with other navigation-mode commands.
Commands like le:move-dot-left
are still in the le:
namespace; they are not considered to be insert-mode-specific.
Test coverage has increased to almost 50%.
The edit
package has seen some cleanups and refactors.
It is now possible to pin and hide directories in location mode, using $le:loc-pinned
and $le:loc-hidden
respectively (#326 #342).
Matching in location mode is now more sensible (#338).
Special builtins and
and or
have been added, with similar semantics as Python.
~> and $true $false
▶ $false
~> and $false ?(echo 233)
▶ $false
~> and $true 1
▶ 1
A not
builtin has been added that negates boolean values.
Pressing Ctrl-V
will now put Elvish into "raw mode" that causes the next key press to be read literally, like in other shells (#182). However, the implementation is now buggy (#350).
An embedded:readline-binding
module has been added. Add use embedded:readline-binding
to get a (partial) readline-esque binding (#339).
An experimental -match
builtin for regular expression matching was added.
A repr
builtin for printing the representation of objects has been added.
Elvish per-se no longer depends on cgo for compiling (#345). However, Elvish still uses sqlite, which requires cgo to compile.
When completing a variable in a namespace, e.g. put $le:lo<Tab>
, the candidate menu now only shows the variable names (like loc-pinned
) instead of the whole qualified name (like $le:loc-pinned
). Under the hood, the definition of what is being matched against candidates, as well as the candidates themselves, have changed. When using the default prefix matcher, this has only consequence on how candidates are displayed. However, for other matchers this will make a difference.
An experimental variable $le:-use-subseq-matcher
has been introduced. If it is set to $true
, Elvish matches completion candidates using a subsequence matching algorithm. Using the example in the previous bullet, in put $le:lo<Tab>
, lo
is used to match against loc-pinned
instead of the entire $le:lo
, because loc-pinned
instead of $le:loc-pinned
is now considered the candidate.