builtin_ns.d.elv 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #elvdoc:var _
  2. #
  3. # A blackhole variable.
  4. #
  5. # Values assigned to it will be discarded. Referencing it always results in $nil.
  6. #elvdoc:var args
  7. #
  8. # A list containing command-line arguments. Analogous to `argv` in some other
  9. # languages. Examples:
  10. #
  11. # ```elvish-transcript
  12. # ~> echo 'put $args' > args.elv
  13. # ~> elvish args.elv foo -bar
  14. # ▶ [foo -bar]
  15. # ~> elvish -c 'put $args' foo -bar
  16. # ▶ [foo -bar]
  17. # ```
  18. #
  19. # As demonstrated above, this variable does not contain the name of the script
  20. # used to invoke it. For that information, use the `src` command.
  21. #
  22. # @cf src
  23. #elvdoc:var false
  24. #
  25. # The boolean false value.
  26. #elvdoc:var ok
  27. #
  28. # The special value used by `?()` to signal absence of exceptions.
  29. #elvdoc:var nil
  30. #
  31. # A special value useful for representing the lack of values.
  32. #elvdoc:var paths
  33. #
  34. # A list of search paths, kept in sync with `$E:PATH`. It is easier to use than
  35. # `$E:PATH`.
  36. #elvdoc:var pid
  37. #
  38. # The process ID of the current Elvish process.
  39. #elvdoc:var pwd
  40. #
  41. # The present working directory. Setting this variable has the same effect as
  42. # `cd`. This variable is most useful in a temporary assignment.
  43. #
  44. # Example:
  45. #
  46. # ```elvish
  47. # ## Updates all git repositories
  48. # for x [*/] {
  49. # pwd=$x {
  50. # if ?(test -d .git) {
  51. # git pull
  52. # }
  53. # }
  54. # }
  55. # ```
  56. #
  57. # Etymology: the `pwd` command.
  58. #
  59. # @cf cd
  60. #elvdoc:var true
  61. #
  62. # The boolean true value.
  63. #elvdoc:var buildinfo
  64. #
  65. # A [psuedo-map](./language.html#pseudo-map) that exposes information about the Elvish binary.
  66. # Running `put $buildinfo | to-json` will produce the same output as `elvish -buildinfo -json`.
  67. #
  68. # @cf $version
  69. #elvdoc:var version
  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. # @cf $buildinfo