Commit Graph

6563 Commits

Author SHA1 Message Date
Qi Xiao
b84204b142
Merge pull request #1714 from tw4452852/monochrome
support monochrome mode
2023-08-21 00:05:58 -04:00
Qi Xiao
607fa68aca Implement os:stat.
Time fields are omitted for now; they will be added when there's a proper Elvish
binding for time.Time.

This addresses #1659.
2023-08-21 00:05:05 -04:00
Qi Xiao
65bc9580cb pkg/eval/evaltest: Print value diffs by converting them with Repr first.
The options to go-cmp doesn't seem to actually transform lists and maps
properly, so use the string representation for diffs now.
2023-08-20 23:30:30 -04:00
Qi Xiao
95ba078ff6 pkg/eval/evaltest: Implement value matchers with interface. 2023-08-13 23:20:54 -04:00
Qi Xiao
f240df4846 pkg/eval/vals: Add utils {Int64,Uint64}ToNum. 2023-08-13 22:46:22 -04:00
Kurtis Rader
204eed9aae Fix a typo detected by spellcheck
While working on an unrelated change I noticed that `make all-checks`
found a typo. I was using codespell 2.2.5 so this also upodates the
.github/workflows/ci.yml file to depend on that release since doing so
does not introduce any false positives.
2023-08-11 21:14:39 -07:00
Tw
288e0481ac support monochrome mode
Use NO_COLOR environment variable to enable monochrome mode in which foreground and background
colors will be stripped.

Signed-off-by: Tw <tw19881113@gmail.com>
2023-08-08 11:40:24 +08:00
Qi Xiao
db0f599a34 Remove a paragraph on unstable symbols being at the end, since it no longer applies. 2023-08-06 12:08:26 -04:00
Qi Xiao
e847e677fe Move a lot of symbols from path: to os:.
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.
2023-08-06 12:06:41 -04:00
Qi Xiao
a1bfc0e231 Add file:seek and file:tell. 2023-07-23 10:24:53 +01:00
Qi Xiao
d56291136a Add an &also-input option to file:open-output. 2023-07-23 09:32:55 +01:00
Qi Xiao
a1b30deb86 pkg/eval/evaltest: Rename TestWithFullSetup -> TestWithSetup.
The old TestWithSetup is now more accurately called TestWithEvalerSetup.
2023-07-22 23:04:18 +01:00
Qi Xiao
b039500b54 Rewrite doc for $unix:umask. 2023-07-22 17:35:58 +01:00
Qi Xiao
981388d5c2 Add file:open-output. 2023-07-22 17:20:19 +01:00
Qi Xiao
cfc914e9ba New read-bytes builtin to read a fixed number of bytes. 2023-07-20 11:24:01 +01:00
Qi Xiao
95037fc1d1 Fix website module. 2023-07-18 21:21:56 +01:00
Qi Xiao
2b68c2d678 Bump dependencies. 2023-07-18 21:13:36 +01:00
Qi Xiao
93423d3244 Support (struct)map with 'r' or 'w' fields in redirections.
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.
2023-07-18 17:52:06 +01:00
Qi Xiao
ad691e7812 Fix lscolors test on Windows. 2023-07-18 12:35:15 +01:00
Qi Xiao
6481284f58
Merge pull request #1711 from mikelward/1245
Make Concat return a new globPattern.
2023-07-17 23:54:01 +01:00
Qi Xiao
a743f959a2 Add regression test for #1710. 2023-07-17 23:51:11 +01:00
Qi Xiao
6992c0b693 Make pseudomaps print like [^tag &key=value].
Also make file:pipe output a struct map rather than a pseudomap.
2023-07-17 23:41:43 +01:00
Mikel Ward
8796233de4 Make Concat return a new globPattern.
I don't know if this is fully sufficient, but it seems to fix the specific test
case mentioned.

Fixes #1245
2023-07-16 18:28:32 +01:00
Qi Xiao
9104632c72
Merge pull request #1710 from delameter/patch-1
Fixes multihardlink directory styling on unix
2023-07-16 17:30:30 +01:00
Alexandr Shavykin
2e1a1e1d38
Update stat_unix.go
Fixes multihardlink directory styling on unix
2023-07-16 18:46:17 +03:00
Qi Xiao
96752afa4d Make struct maps indistinguishable from maps to Elvish code.
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.
2023-07-14 23:57:38 +01:00
Qi Xiao
900cc52b05 Fix the hash code of maps. 2023-07-14 22:01:32 +01:00
Qi Xiao
cf23f0cce4 Bump binary builders in CI to 1.20.6. 2023-07-14 00:18:13 +01:00
Qi Xiao
78e84a4d7e .cirrus.yml: Fix some yaml-schema violations. 2023-07-14 00:15:59 +01:00
Qi Xiao
0b2c6d5353 .cirrus.yml: Fix OpenBSD image family. 2023-07-14 00:11:49 +01:00
Qi Xiao
79dd189a72 .cirrus.yml: Fix NetBSD and OpenBSD. 2023-07-14 00:02:26 +01:00
Qi Xiao
762e4bca5a .cirrus.yml: Bump FreeBSD Go toolchain version. 2023-07-13 22:43:18 +01:00
Qi Xiao
5edb915d1a Fix build tag of Unix-only test file. 2023-07-13 22:21:36 +01:00
Qi Xiao
17a41afa72 vscode: Bump dependencies and version number. 2023-07-13 22:19:02 +01:00
Qi Xiao
0e9287f12a vscode/sample.elv: Add trailing newline. 2023-07-13 22:18:29 +01:00
Qi Xiao
34cc3653f9 pkg/cli/modes: Fix the handling of named pipes in nav previews. 2023-07-13 22:12:12 +01:00
Qi Xiao
9a1948b167 pkg/wcwidth: Clarify which part is taken from another implementation.
Also refactor the isCombining function a bit to not depend directly on
combiningRanges.
2023-07-13 21:46:42 +01:00
Qi Xiao
aa24cd2851 pkg/edit/complete: Use default arg generator for RHS of "set" and "tmp".
This fixes #1704.
2023-05-27 10:53:06 +01:00
Qi Xiao
f0c5767ab6 pkg/eval: Use json.Number in from-json. 2023-05-22 07:35:17 +01:00
Qi Xiao
155ea5acb1 pkg/eval: Bump the sleep time in the test for peach more.
Another failure in the Linux ARM64 runner: https://cirrus-ci.com/task/6301954620522496
2023-05-20 11:55:31 +01:00
Qi Xiao
90187c8d7c Fixup for #1699.
- Remove description fields; just use the keys as the descriptions.

- Remove ( ) around conditions.

- Add more special commands.

- Add "Snippets" as a category of the extension.

Also bump extension version - I accidentally published a WIP version as 0.2.1,
so bump it to 0.2.2.
2023-05-20 11:48:47 +01:00
Qi Xiao
30090e4fa2
Merge pull request #1699 from EmilySeville7cfg/feature/add-basic-snippets
Add basic VS Code snippets
2023-05-20 11:34:23 +01:00
Qi Xiao
2fe4512556 pkg/eval/vals: Make Repr sort map keys before printing.
This addresses #1495.
2023-05-20 10:52:52 +01:00
Qi Xiao
7c0c3eb82d pkg/eval/vals: Correct the godoc of Cmp. 2023-05-20 10:20:48 +01:00
Qi Xiao
c71995ba9a pkg/eval: Add tests for "order &total". 2023-05-19 17:27:37 +01:00
Qi Xiao
058f9818ae pkg/eval: Fix the equality test in "has-value".
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.
2023-05-19 17:25:36 +01:00
Qi Xiao
3f4bbff9c5 pkg/eval: Add option for total order to the order and compare commands.
The same code will be used to sort map keys when printing maps.

This addresses #1495.
2023-05-18 23:21:18 +01:00
Qi Xiao
25e27d6bb6 pkg/eval/vals: Make Cmp(a, b) return CmpEqual if Equal(a, b).
Also match the order of branches in Cmp and Equal.
2023-05-18 10:45:42 +01:00
Qi Xiao
1e249ed7fb pkg/eval.cmp -> pkg/eval/vals.Cmp. 2023-05-18 10:31:31 +01:00
Qi Xiao
19bd75db57 pkg/eval: Make the peach test cases print $best-run on failure. 2023-05-08 23:34:04 +01:00