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

     1  #//skip-test
     2  
     3  # Changes directory.
     4  #
     5  # This affects the entire process, including parallel tasks that are started
     6  # implicitly (such as prompt functions) or explicitly (such as one started by
     7  # [`peach`]()).
     8  #
     9  # Note that Elvish's `cd` does not support `cd -`.
    10  #
    11  # In interactive shells, [location mode](../learn/tour.html#directory-history)
    12  # provides an alternative to quickly change to past directories.
    13  #
    14  # See also [`$pwd`]().
    15  fn cd {|dirname| }
    16  
    17  # If `$path` represents a path under the home directory, replace the home
    18  # directory with `~`. Examples:
    19  #
    20  # ```elvish-transcript
    21  # ~> echo $E:HOME
    22  # /Users/foo
    23  # ~> tilde-abbr /Users/foo
    24  # ▶ '~'
    25  # ~> tilde-abbr /Users/foobar
    26  # ▶ /Users/foobar
    27  # ~> tilde-abbr /Users/foo/a/b
    28  # ▶ '~/a/b'
    29  # ```
    30  fn tilde-abbr {|path| }