src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/builtin_ns.d.elv (about)

     1  # A blackhole variable.
     2  #
     3  # Values assigned to it will be discarded. Referencing it always results in $nil.
     4  var _
     5  
     6  #//skip-test
     7  # A list containing command-line arguments. Analogous to `argv` in some other
     8  # languages. Examples:
     9  #
    10  # ```elvish-transcript
    11  # ~> echo 'put $args' > args.elv
    12  # ~> elvish args.elv foo -bar
    13  # ▶ [foo -bar]
    14  # ~> elvish -c 'put $args' foo -bar
    15  # ▶ [foo -bar]
    16  # ```
    17  #
    18  # As demonstrated above, this variable does not contain the name of the script
    19  # used to invoke it. For that information, use the `src` command.
    20  #
    21  # See also [`src`]().
    22  var args
    23  
    24  # The boolean false value.
    25  var false
    26  
    27  # The special value used by `?()` to signal absence of exceptions.
    28  var ok
    29  
    30  # A special value useful for representing the lack of values.
    31  var nil
    32  
    33  # A list of search paths, kept in sync with `$E:PATH`. It is easier to use than
    34  # `$E:PATH`.
    35  var paths
    36  
    37  # The process ID of the current Elvish process.
    38  var pid
    39  
    40  # The present working directory. Setting this variable has the same effect as
    41  # `cd`. This variable is most useful in a temporary assignment.
    42  #
    43  # Example:
    44  #
    45  # ```elvish
    46  # ## Updates all git repositories
    47  # use path
    48  # for x [*/] {
    49  #   tmp pwd = $x
    50  #   if (path:is-dir .git) {
    51  #     git pull
    52  #   }
    53  # }
    54  # ```
    55  #
    56  # Etymology: the `pwd` command.
    57  #
    58  # See also [`cd`]().
    59  var pwd
    60  
    61  # The boolean true value.
    62  var true
    63  
    64  # A map that exposes information about the Elvish binary. Running `put
    65  # $buildinfo | to-json` will produce the same output as `elvish -buildinfo
    66  # -json`.
    67  #
    68  # See also [`$version`]().
    69  var buildinfo
    70  
    71  # The full version of the Elvish binary as a string. This is the same information reported by
    72  # `elvish -version` and the value of `$buildinfo[version]`.
    73  #
    74  # **Note:** In general it is better to perform functionality tests rather than testing `$version`.
    75  # For example, do something like
    76  #
    77  # ```elvish
    78  # has-key $builtin: new-var
    79  # ```
    80  #
    81  # to test if variable `new-var` is available rather than comparing against `$version` to see if the
    82  # elvish version is equal to or newer than the version that introduced `new-var`.
    83  #
    84  # See also [`$buildinfo`]().
    85  var version