Also rename &posix to &sep-posix, and add &sep-longest.
The original eawk name is documented as deprecated but doesn't emit deprecation
warnings during compilation yet; this will be fixed in the next commit.
One of the biggest pain points of using elvish
as a shell in practice has been parsing output from
shell commands that return text.
Many CLIs are parseable by AWK. This commit
adds the AWK separator argument to eawk,
which should make it easier to parse the
output of many shell commands.
Most of the symbols moved originate from Go's os package. However,
eval-symlink, which is provided by Go's path/filepath package, is also moved to
the os: module since it requires actual filesystem access. The idea is that
Elvish's path: will only provide functionalities for lexically manipulating
file paths without referencing the actual filesystem, akin to Python's
pathlib.PurePath.
The old symbols in path: are not formally deprecated since the compiler can't
statically check symbols in modules yet.
Now that pipe is a structmap and structmaps are considered indistinguishable to
normal maps, IO redirection should support arbitrary maps too.
Update the relevant section in the language spec and rewrite it a bit.
Struct map is a mechanism to let Go code expose simple structs to Elvish code.
The difference between struct maps and maps is convenience for Go code; they
also have different performance characteristics, but since struct maps are
always quite small, the difference is not meaningful for Elvish's use cases.
As a result, there is no good reason that Elvish code needs to be aware of the
difference between struct maps and normal maps. Making them indistinguishable to
Elvish code simplifies the language.
This commit does the following:
- Change Equal, Hash, Kind and Repr to treat struct maps like maps.
- Change Assoc and Dissoc to "promote" struct maps to maps.
- Remove the custom Repr method of parse.Source.
- Update documentation to reflect this change.
Previously Go's == was used to test for equality when the container is not a
map, which is more strict when Elvish's normal equality test. For example,
"has-value [[foo]] [foo]" used to output false, rather than the expected true.
This fixes#1668, because the crashing listbox rendering code uses "len(line) >
0" (where line is a ui.Text) to test whether it is non-empty. This test doesn't
work with the ui.Text constructed using "styled ''", which creates a ui.Text
with one empty segment.
The functions from the ui package are guaranteed to never return such ui.Text
instances, so switching the implementation of the styled builtin to functions
from the ui package fixes this.
* Correct slice indexing convention in code comment
A colon is not supported.
* Add more key slices tests
* Unify `has-key` tests with those from `pkg/eval/vals/has_key_test.go`
* Fix key slice format in documentation
Fixes#1646.
* Fix missing bracket
* Fix indexing
* Add more key slices `has-key` tests
* Fix `has-key` test expected value