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

     1  #//skip-test
     2  
     3  # Output a map describing the current source, which is the source file or
     4  # interactive command that contains the call to `src`. The value contains the
     5  # following fields:
     6  #
     7  # -   `name`, a unique name of the current source. If the source originates from a
     8  #     file, it is the full path of the file.
     9  #
    10  # -   `code`, the full body of the current source.
    11  #
    12  # -   `is-file`, whether the source originates from a file.
    13  #
    14  # Examples:
    15  #
    16  # ```elvish-transcript
    17  # ~> src
    18  # ▶ [&code=src &is-file=$false &name='[tty 1]']
    19  # ~> elvish show-src.elv
    20  # ▶ [&code="src\n" &is-file=$true &name=/home/elf/show-src.elv]
    21  # ~> echo src > .config/elvish/lib/show-src.elv
    22  # ~> use show-src
    23  # ▶ [&code="src\n" &is-file=$true &name=/home/elf/.config/elvish/lib/show-src.elv]
    24  # ```
    25  fn src { }
    26  
    27  #doc:show-unstable
    28  # Force the Go garbage collector to run.
    29  #
    30  # This is only useful for debug purposes.
    31  fn -gc { }
    32  
    33  #doc:show-unstable
    34  # Print a stack trace.
    35  #
    36  # This is only useful for debug purposes.
    37  fn -stack { }
    38  
    39  #doc:show-unstable
    40  # Direct internal debug logs to the named file.
    41  #
    42  # This is only useful for debug purposes.
    43  fn -log {|filename| }