elvish-command(7)
π Introduction π
okay so bestie, listen. The Elvish command, elvish, literally contains the Elvish shell, and it's the main character way to use the Elvish programming language. π«Ά This doc right here? It's all about how elvish behaves when it's not part of the language itself and not part of any of the standard modules. Just the shell vibes. β¨
πΈ Using Elvish interactively πΈ
If you invoke Elvish with no argument, it runs in interactive mode β unless there are flags that suppress this behavior, in which case, no REPL for you. π
In this mode, Elvish runs a REPL (read-eval-print loop) that evaluates input continuously. The "read" part of that REPL is a rich interactive editor, and its API is exposed by the edit: module. Every unit of code that gets read is executed as a code chunk. Slay. π
π RC file π
Before the REPL even starts, Elvish will execute the RC file. Its path is determined like this:
- If the legacy
~/.elvish/rc.elvexists, it is used (this will be ignored in a future version). - Otherwise:
- On UNIX (including macOS),
$XDG_CONFIG_HOME/elvish/rc.elvis used, defaulting to~/.config/elvish/rc.elvif$XDG_CONFIG_HOMEis unset or empty. - On Windows,
%AppData%\elvish\rc.elvis used.
- On UNIX (including macOS),
If the RC file doesn't exist, Elvish does not execute any RC file. No RC, no drama, periodt. β¨
π¦ Database file π¦
Elvish in interactive mode uses a database file to keep command and directory history. Its path is determined like this:
- If the legacy
~/.elvish/dbexists, it is used (this will be ignored in a future version). - Otherwise:
- On UNIX (including macOS),
$XDG_DATA_HOME/elvish/db.boltis used, defaulting to~/.local/state/elvish/db.boltif$XDG_DATA_HOMEis unset or empty. - On Windows,
%LocalAppData%\elvish\db.boltis used.
- On UNIX (including macOS),
π₯ Running a script π₯
Invoking Elvish with one or more arguments will cause Elvish to execute a script β unless there are flags that suppress this behavior, you know the drill. π
- If the
-cflag is given, the first argument is executed as a single code chunk. - If the
-cflag is not given, the first argument is taken as a filename, and the content of the file is executed as a single code chunk.
The remaining arguments are put in $args. π§
π Module search directories π
When importing modules, Elvish searches the following directories:
- On UNIX:
$XDG_CONFIG_HOME/elvish/lib, defaulting to~/.config/elvish/libif$XDG_CONFIG_HOMEis unset or empty;$XDG_DATA_HOME/elvish/lib, defaulting to~/.local/share/elvish/libif$XDG_DATA_HOMEis unset or empty;- Paths specified in the colon-delimited
$XDG_DATA_DIRS, followed byelvish/lib, defaulting to/usr/local/share/elvish/liband/usr/share/elvish/libif$XDG_DATA_DIRSis unset or empty.
- On Windows:
%AppData%\elvish\lib, followed by%LocalAppData%\elvish\lib.
If the legacy ~/.elvish/lib directory exists, it is also searched. π
β Other command-line flags β
Running elvish -help lists all supported command-line flags, which are not repeated here. iykyk. π
and that's the whole page, bestie!! π this was elvish-command(7), from the Miscellaneous Information Manual, brought to you by Elvish version 0.17.0 dated Nov 18, 2024. go forth and shell, you icon. ππ
π¦ where this page comes from
- ubuntu jammy: elvish 0.17.0-1ubuntu0.1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms