Commit Graph

6416 Commits

Author SHA1 Message Date
Qi Xiao
fef5049716 pkg/eval: Simplify how exception tracebacks are written.
*Exception.Show used to work differently when the traceback contains one frame
vs more frames. Harmonize how they work, and consistent with how parse errors
and compilation errors are shown.
2024-01-16 12:50:59 +00:00
Qi Xiao
cfe4c0051d pkg/diag: Remove Complain and Complainf
The former is unused, and the latter is only used from pkg/edit/config_api.go.
Subsume the logic into ShowError, and use that from pkg/edit/config_api.go.
2024-01-16 11:09:57 +00:00
Qi Xiao
5775c8b3ed pkg/diag: Rework API and presentation of Context and Error.
- Change Context to export all its fields.

- Include end position in Context, and include it in Show.

- Remove the Type field from Error, and express it using an ErrorTag type
  parameter instead.

- Make {Pack Unpack}CognateErrors type-safe with the new ErrorTag mechanism, and
  rename them to just {Pack Unpack}Errors.
2024-01-16 11:04:52 +00:00
Qi Xiao
76e2d3cb61 Fix test on Windows.
A Windows test case was missed when changing the pkg/tt API.
2024-01-11 16:36:52 +00:00
Qi Xiao
6dfa4f623b .github/workflows: Fix step condition.
Expressions that start with ! must use ${{ }} explicitly:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif
2024-01-11 16:31:41 +00:00
Qi Xiao
36e1272fd7 .github/workflows: Clean up workflow definitions.
- Fix the cache key used in check_website.yml. It was blindly copied from ci.yml
  and contained matrix parameters that are not present in this workflow.

- Simplify the derivation of OS_TYPE used for tagging coverages to use a ternary
  expression.

- Simplify the condition for uploading coverages by introducing a new "old-go"
  matrix parameter.
2024-01-11 15:44:50 +00:00
Qi Xiao
6e36058d0a pkg/tt: Improve API.
- Use reflection to derive function name.

- Take test cases as variadic arguments, instead of requiring them to be wrapped
  in a Table.

- Support naming test cases.

- Run test cases as subtests with t.Run.
2024-01-11 15:42:43 +00:00
Qi Xiao
82b32d4ace website/tools/mkdsidx.py: Fix use of quotes in generated SQL.
The script used to emit double-quoted strings, which is not standard SQL
syntax and support for it in SQLite been disabled by default since 3.41.0
(https://www.sqlite.org/changes.html).
2024-01-11 00:03:32 +00:00
Qi Xiao
6a4204dec5 Bump Go version in CI tasks for checking binaries. 2024-01-10 23:41:51 +00:00
Qi Xiao
d013121af6 Require Go >= 1.20, and bump CI environment versions.
Also:

- Fix new deprecations in Go 1.20.

- Remove the unused .gitlab-ci.yml.
2024-01-10 22:28:18 +00:00
Qi Xiao
ff97d08cd7 pkg/mods/math: Fix examples of ceil to actually use ceil.
This fixes #1747.
2024-01-10 21:31:42 +00:00
Qi Xiao
8d8e5ae841 pkg/mods/{readlinebinding -> readline-binding}.
We now assume that the directory name under pkg/mods match exactly with the
Elvish module name in several places, and this mismatch broke website building.

Go allows dashes in directory names; it just forbids them in the package name
and there's actually no requirement that the directory name and the package name
be the same.
2024-01-09 13:52:16 +00:00
Qi Xiao
d7b6600dff Upgrade dependencies. 2024-01-09 13:45:32 +00:00
Qi Xiao
e74cda7bc3 website/cmd/md2html: Reduce dependency on Elvish packages.
This command used to depend on pkg/mods/doc to access the embedded .elv, which
in turn depends on all the packages that implement builtin modules. The latter
set of packages depends on almost all the Elvish packages transitively. As a
result, almost any change in any Elvish package will trigger a rebuild of this
command and the whole website.

This commit minimizes the dependency on Elvish packages by having it read the
.elv files during runtime instead (enabled by
9112eb1ab2).

Additionally:

- Move HighlightCodeBlock, needed by website/cmd/md2html, from pkg/mods/doc
  to pkg/elvdoc. Moving it is necessary to completely remove the dependency of
  website/cmd/md2html on pkg/mods/doc.

- Remove the dependency of pkg/edit/highlight on pkg/eval. It only uses
  eval.UnpackCompilationErrors; move this work to the supplied Check function.
  This removes the transitive dependency of website/cmd/md2html on pkg/eval.

- Augment website/tools/md-deps to recognize @module lines and add dependency on
  the corresponding .elv files.
2024-01-09 13:36:57 +00:00
Qi Xiao
1cfe72a692 website/cmd/md2html: Fix [foo]() (unqualified) outside builtin.html.
This syntax has been documented to have an implicit destination of
builtin.html#foo, but it never worked correctly outside builtin.html itself.

Also do some minor cleanups of the package, including removing bogus package
godocs that were inherited from the previous version where the components were
separate programs.
2024-01-08 22:45:28 +00:00
Qi Xiao
9112eb1ab2 Simplify how .elv files are embedded for builtin documentation.
Instead of having each individual module embed their .elv files and collect all
of them in pkg/mods/doc, have a single embed.FS at pkg that includes everything,
and use that pkg/mods/doc.

Implement a function that extracts all module elvdocs, and put it in pkg/elvdoc.
2024-01-08 16:44:35 +00:00
Qi Xiao
791b4857e1 pkg/eval/evaltest: Fix the bytes output error message. 2024-01-08 15:44:14 +00:00
Qi Xiao
e583ed0c3c pkg/md: Minor wording updates to godoc. 2024-01-04 16:39:45 +00:00
Qi Xiao
2481b755ff pkg/mods/os: Replace use of ld with os:stat in a test. 2024-01-04 11:52:05 +00:00
Qi Xiao
a780ff71a9 pkg/mods/os: Fix test on Windows. 2024-01-04 11:51:06 +00:00
Qi Xiao
f2fe6af218 CONTRIBUTING.md: Describe my role more accurately.
"Project lead" is quite vague. Make it clear that I'm the only person with
direct commit access.
2024-01-04 11:44:25 +00:00
Qi Xiao
d5e66c23bb website/README.md: Use elvish-transcript as the tag for a ttyshot example. 2024-01-03 22:13:31 +00:00
Qi Xiao
cf9ec15fa6 Implement os:chmod.
This supersedes #1730.
2024-01-03 22:02:57 +00:00
Qi Xiao
266e01d474 Reformat os.md to placate the style checker 2024-01-03 12:05:00 +00:00
Wyatt Campbell
a1a56e9789 Changed os reference documentation to use follow-symlink instead of old eval-symlinks 2024-01-03 12:05:00 +00:00
Qi Xiao
66dc7c9bf0
Merge pull request #1740 from krader1961/issue-1738-key-down
Fix edit:insert:binding regression
2024-01-03 11:48:57 +00:00
Qi Xiao
d86b61cac9 Fix broken links in d.elv files. 2024-01-02 19:38:14 +00:00
Qi Xiao
8e67588090 pkg/eval: Remove unused toFloat64. 2024-01-02 19:34:31 +00:00
Qi Xiao
4fd1b9525f Document deprecation of eawk and removal of float64 in release notes. 2024-01-02 19:33:37 +00:00
Qi Xiao
1865db6542 Merge branch 'merge-eawk-sep' 2024-01-02 15:11:55 +00:00
Qi Xiao
7d38243540 Remove float64, and deprecate eawk from 0.20.0. 2024-01-02 15:11:38 +00:00
Qi Xiao
e4564688bf Rename eawk -> re:awk.
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.
2024-01-02 15:07:37 +00:00
Qi Xiao
e105493ac8 pkg/cli: Fix the height distribution algorithm to match the comment. 2023-12-31 21:19:32 +00:00
Qi Xiao
7c429c70d4 Fix the rendering of listboxes when height = 1.
Fix the division by 0, and special-case this condition to show one row of
content and hide the scrollbar.

This supersedes #1736.
2023-12-31 21:16:28 +00:00
Qi Xiao
495f427e66
Merge pull request #1728 from saolof/eawk_improvements
Make eawk accept a custom separator
2023-12-27 23:47:41 +00:00
Kurtis Rader
1d4375027f Fix edit:insert:binding regression
Add an insert mode binding that was accidently lost by an earlier refactoring
that moved default bindings from Go code to embedded Elvish code.

Fixes #1738
2023-12-26 20:55:45 -08:00
Qi Xiao
b3eaccd7e7 Bump version of staticcheck and codespell. 2023-12-26 20:47:52 +00:00
Qi Xiao
1125300f17
Merge pull request #1732 from krader1961/fix-typos
Fix typos
2023-12-26 20:38:56 +00:00
Kurtis Rader
0e9c21e8bf Fix typos
I recently upgraded my `codespell` command to version 2.2.6 which caused
creating a pull-request to catch the typos fixed by this change.
2023-11-19 21:44:44 -08:00
Olof Salberger
674740fbc6 Fix typo in comment 2023-10-14 09:09:34 +02:00
Olof Salberger
a274aa1676 Added real world test with docker image ls output 2023-10-14 08:43:36 +02:00
Olof Salberger
1b6477878e Add separator pattern to eawk
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.
2023-10-13 00:50:10 +02:00
Olof Salberger
9e1aee42d3 Modernize Dockerfile. 2023-10-12 23:48:51 +02:00
Qi Xiao
1c0cffbfed pkg/eval/vals/cmp.go: Use compareBuiltin for strings too. 2023-08-25 22:18:05 -04:00
Qi Xiao
a15f0f7d0a pkg/eval/vals: Test that structmaps are treated like maps by CmpTotal. 2023-08-22 22:07:26 -04:00
Qi Xiao
4ceb91901e pkg/eval/vals: Pretend structmaps are maps in typeOf too. 2023-08-22 21:56:02 -04:00
Qi Xiao
62795d907d Format the rule used by compare as an ordered list. 2023-08-22 21:20:46 -04:00
Qi Xiao
fbde7b1208 Fix name of &total option for the order command. 2023-08-22 21:12:52 -04:00
Qi Xiao
efae7e0644 Bump staticcheck to 0.4.5, and update CONTRIBUTING.md.
Also add comments in both CONTRIBUTING.md and .github/workflows/ci.yml about
keeping the versions in sync.
2023-08-21 00:33:58 -04:00
Qi Xiao
1b10161291
Merge pull request #1716 from krader1961/typo-fixup
Fix a typo detected by spellcheck
2023-08-21 00:30:59 -04:00