2022-11-21 05:52:11 +08:00
|
|
|
# A blackhole variable.
|
|
|
|
#
|
|
|
|
# Values assigned to it will be discarded. Referencing it always results in $nil.
|
2022-11-22 22:13:25 +08:00
|
|
|
var _
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# A list containing command-line arguments. Analogous to `argv` in some other
|
|
|
|
# languages. Examples:
|
|
|
|
#
|
|
|
|
# ```elvish-transcript
|
|
|
|
# ~> echo 'put $args' > args.elv
|
|
|
|
# ~> elvish args.elv foo -bar
|
|
|
|
# ▶ [foo -bar]
|
|
|
|
# ~> elvish -c 'put $args' foo -bar
|
|
|
|
# ▶ [foo -bar]
|
|
|
|
# ```
|
|
|
|
#
|
|
|
|
# As demonstrated above, this variable does not contain the name of the script
|
|
|
|
# used to invoke it. For that information, use the `src` command.
|
|
|
|
#
|
2023-01-02 10:17:54 +08:00
|
|
|
# See also [`src`]().
|
2022-11-22 22:13:25 +08:00
|
|
|
var args
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The boolean false value.
|
2022-11-22 22:13:25 +08:00
|
|
|
var false
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The special value used by `?()` to signal absence of exceptions.
|
2022-11-22 22:13:25 +08:00
|
|
|
var ok
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# A special value useful for representing the lack of values.
|
2022-11-22 22:13:25 +08:00
|
|
|
var nil
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# A list of search paths, kept in sync with `$E:PATH`. It is easier to use than
|
|
|
|
# `$E:PATH`.
|
2022-11-22 22:13:25 +08:00
|
|
|
var paths
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The process ID of the current Elvish process.
|
2022-11-22 22:13:25 +08:00
|
|
|
var pid
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The present working directory. Setting this variable has the same effect as
|
|
|
|
# `cd`. This variable is most useful in a temporary assignment.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# ```elvish
|
|
|
|
# ## Updates all git repositories
|
2022-12-31 02:36:31 +08:00
|
|
|
# use path
|
2022-11-21 05:52:11 +08:00
|
|
|
# for x [*/] {
|
2022-12-31 02:30:47 +08:00
|
|
|
# tmp pwd = $x
|
2022-12-31 02:36:31 +08:00
|
|
|
# if (path:is-dir .git) {
|
2022-12-31 02:30:47 +08:00
|
|
|
# git pull
|
2022-11-21 05:52:11 +08:00
|
|
|
# }
|
|
|
|
# }
|
|
|
|
# ```
|
|
|
|
#
|
|
|
|
# Etymology: the `pwd` command.
|
|
|
|
#
|
2023-01-02 10:17:54 +08:00
|
|
|
# See also [`cd`]().
|
2022-11-22 22:13:25 +08:00
|
|
|
var pwd
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The boolean true value.
|
2022-11-22 22:13:25 +08:00
|
|
|
var true
|
2022-11-21 05:52:11 +08:00
|
|
|
|
2023-01-02 09:34:40 +08:00
|
|
|
# A [psuedo-map](language.html#pseudo-map) that exposes information about the Elvish binary.
|
2022-11-21 05:52:11 +08:00
|
|
|
# Running `put $buildinfo | to-json` will produce the same output as `elvish -buildinfo -json`.
|
|
|
|
#
|
2023-01-02 10:17:54 +08:00
|
|
|
# See also [`$version`]().
|
2022-11-22 22:13:25 +08:00
|
|
|
var buildinfo
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# The full version of the Elvish binary as a string. This is the same information reported by
|
|
|
|
# `elvish -version` and the value of `$buildinfo[version]`.
|
|
|
|
#
|
|
|
|
# **Note:** In general it is better to perform functionality tests rather than testing `$version`.
|
|
|
|
# For example, do something like
|
|
|
|
#
|
|
|
|
# ```elvish
|
|
|
|
# has-key $builtin: new-var
|
|
|
|
# ```
|
|
|
|
#
|
|
|
|
# to test if variable `new-var` is available rather than comparing against `$version` to see if the
|
|
|
|
# elvish version is equal to or newer than the version that introduced `new-var`.
|
|
|
|
#
|
2023-01-02 10:17:54 +08:00
|
|
|
# See also [`$buildinfo`]().
|
2022-11-22 22:13:25 +08:00
|
|
|
var version
|