- Move from pkg/eval/mods to pkg/mods
- Introduce mods.AddTo that adds all standard library modules
- Move epm and readline-binding into their own packages
In particular, the code for retrieving file paths needed by the runtime is
simplified a lot, and the paths only needed for the storage daemon is cleanly
separated from other paths.
The dependency is injected via a field in shell.Program.
Also add an alternative entrypoint, cmd/nodaemon/elvish, which does not include
the daemon server or client.
The `edit:after-command` hooks are called with a single argument:
a pseudo-map with these keys:
"command": the command line that was run
"duration": the execution duration in seconds
"error": any error that occurred ($nil if no error occurred)
The `edit:command-duration` variable is the elapsed seconds (as a
float64) of the most recently run interactive command.
Resolves#1029
* Move all widget types to a new pkg/cli/tk.
* Move Mode{Line Prompt} to a new pkg/cli/mode.
* Move all packages in pkg/cli/addons to pkg/cli/mode.
* Remove WriteListing.
* Remove StdTTY.
* Rename GetCodeBuffer to CodeBuffer.
* Introduce the `path:` module
This is based on https://github.com/elves/elvish/pull/1084 by @kolbycrouch
submitted five months ago. It addresses all of the feedback on that
change and includes other documentation and unit test improvements. It
also includes a couple of extensions to the original P.R., such as a
`path:is-abs` command.
I decided to resurrect that change because I want better support for
filesystem path manipulation so that users can replace non-portable
external commands such as `realpath` and `find` with Elvish builtins. This
is a baby step towards that goal.
Related #849
* Add a `path:is-regular` command
This adds a `path:is-regular` command. This is for symmetry with the
`path:is-dir` command and the glob `[type:regular]` modifier.
It also adds support for symlinks in the `testutil.Applydir` function
and change the path unit test to use it.
* Rename path:real to path:eval-symlinks
The Elvish daemon should not inherit file descriptors open on the tty.
Make the daemon's stdin open on the null device and its stdout/stderr
open on a predictable file.
Fixes#1191
This change makes Ns immutable from the exposed API. Internally there is exactly
one place that still mutates Ns, in scopeOp; this will be addressed later.
- Make Evaler mostly thread-safe. The only remaining thread-unsafe part is the
modules field, which is more tricky than other fields.
- Remove the state and evalerScopes type, and move their fields into Evaler.
- Expose valuePrefix via a get method, and change PortsFromFiles to take the
prefix instead of a *Evaler. Also expose a PortsFromStdFiles.
- Make Evaler a normal field of Frame, instead of an embedded field. This makes
access to global states more explicit.
The new (*Evaler).Check method allows the implementation to be simpler.
Also test the JSON format feature in an integration test instead of unit test;
this makes it unnecessary for the eval package to expose NewCompilationError.
This method has the property that it always tries to compile the code even if
there is a parse failure. This is the more desirable behavior when checking
code: if there is a parse failure near the end of a chunk of code, the user may
like to learn about compile errors earlier in the code.