2023-07-15 06:45:25 +08:00
|
|
|
# Output a map describing the current source, which is the source file or
|
|
|
|
# interactive command that contains the call to `src`. The value contains the
|
|
|
|
# following fields:
|
2022-11-21 05:52:11 +08:00
|
|
|
#
|
|
|
|
# - `name`, a unique name of the current source. If the source originates from a
|
|
|
|
# file, it is the full path of the file.
|
|
|
|
#
|
|
|
|
# - `code`, the full body of the current source.
|
|
|
|
#
|
|
|
|
# - `is-file`, whether the source originates from a file.
|
|
|
|
#
|
|
|
|
# Examples:
|
|
|
|
#
|
|
|
|
# ```elvish-transcript
|
2023-07-15 06:45:25 +08:00
|
|
|
# ~> src
|
|
|
|
# ▶ [&code=src &is-file=$false &name='[tty 1]']
|
2022-11-21 05:52:11 +08:00
|
|
|
# ~> elvish show-src.elv
|
2023-07-15 06:45:25 +08:00
|
|
|
# ▶ [&code="src\n" &is-file=$true &name=/home/elf/show-src.elv]
|
|
|
|
# ~> echo src > .config/elvish/lib/show-src.elv
|
|
|
|
# ~> use show-src
|
|
|
|
# ▶ [&code="src\n" &is-file=$true &name=/home/elf/.config/elvish/lib/show-src.elv]
|
2022-11-21 05:52:11 +08:00
|
|
|
# ```
|
2022-11-22 22:13:25 +08:00
|
|
|
fn src { }
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# Force the Go garbage collector to run.
|
|
|
|
#
|
|
|
|
# This is only useful for debug purposes.
|
2022-11-22 22:13:25 +08:00
|
|
|
#doc:show-unstable
|
|
|
|
fn -gc { }
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# Print a stack trace.
|
|
|
|
#
|
|
|
|
# This is only useful for debug purposes.
|
2022-11-22 22:13:25 +08:00
|
|
|
#doc:show-unstable
|
|
|
|
fn -stack { }
|
2022-11-21 05:52:11 +08:00
|
|
|
|
|
|
|
# Direct internal debug logs to the named file.
|
|
|
|
#
|
|
|
|
# This is only useful for debug purposes.
|
2022-11-22 22:13:25 +08:00
|
|
|
#doc:show-unstable
|
|
|
|
fn -log {|filename| }
|