mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Introduce $FISH_DEBUG and $FISH_DEBUG_OUTPUT variables
Same as the `--debug` and `--debug-output` options, can be enabled when the option can't be passed, e.g. in linux shebangs. Fixes #7359.
This commit is contained in:
@@ -63,3 +63,7 @@ Available categories are listed by ``fish --print-debug-categories``. The ``--de
|
||||
Debug messages output to stderr by default. Note that if ``fish_trace`` is set, execution tracing also outputs to stderr by default. You can output to a file using the ``--debug-output`` option::
|
||||
|
||||
> fish --debug='complete,*history*' --debug-output=/tmp/fish.log --init-command='set fish_trace on'
|
||||
|
||||
These options can also be changed via the $FISH_DEBUG and $FISH_DEBUG_OUTPUT variables. The categories enabled via ``--debug`` are *added* to the ones enabled by $FISH_DEBUG, so they can be disabled by prefixing them with ``-`` (``reader-*,-ast*`` enables reader debugging and disables ast debugging).
|
||||
|
||||
The file given in ``--debug-output`` takes precedence over the file in $FISH_DEBUG_OUTPUT.
|
||||
|
||||
@@ -1256,6 +1256,8 @@ You can change the settings of fish by changing the values of certain variables.
|
||||
|
||||
- ``fish_emoji_width`` controls whether fish assumes emoji render as 2 cells or 1 cell wide. This is necessary because the correct value changed from 1 to 2 in Unicode 9, and some terminals may not be aware. Set this if you see graphical glitching related to emoji (or other "special" characters). It should usually be auto-detected.
|
||||
|
||||
- ``FISH_DEBUG`` and ``FISH_DEBUG_OUTPUT`` control what debug output fish generates and where it puts it, analogous to the ``--debug`` and ``--debug-output`` options. These have to be set on startup, via e.g. ``FISH_DEBUG='reader*' FISH_DEBUG_OUTPUT=/tmp/fishlog fish``.
|
||||
|
||||
- ``fish_escape_delay_ms`` sets how long fish waits for another key after seeing an escape, to distinguish pressing the escape key from the start of an escape sequence. The default is 30ms. Increasing it increases the latency but allows pressing escape instead of alt for alt+character bindings. For more information, see :ref:`the chapter in the bind documentation <cmd-bind-escape>`.
|
||||
|
||||
- ``fish_greeting``, the greeting message printed on startup. This is printed by a function of the same name that can be overridden for more complicated changes (see :ref:`funced <cmd-funced>`
|
||||
|
||||
13
src/fish.cpp
13
src/fish.cpp
@@ -419,10 +419,23 @@ int main(int argc, char **argv) {
|
||||
argv = const_cast<char **>(dummy_argv); //!OCLINT(parameter reassignment)
|
||||
argc = 1; //!OCLINT(parameter reassignment)
|
||||
}
|
||||
|
||||
// Enable debug categories set in FISH_DEBUG.
|
||||
// This is in *addition* to the ones given via --debug.
|
||||
if (const char *debug_categories = getenv("FISH_DEBUG")) {
|
||||
activate_flog_categories_by_pattern(str2wcstring(debug_categories));
|
||||
}
|
||||
|
||||
fish_cmd_opts_t opts{};
|
||||
my_optind = fish_parse_opt(argc, argv, &opts);
|
||||
|
||||
// Direct any debug output right away.
|
||||
// --debug-output takes precedence, otherwise $FISH_DEBUG_OUTPUT is used.
|
||||
if (opts.debug_output.empty()) {
|
||||
const char *var = getenv("FISH_DEBUG_OUTPUT");
|
||||
if (var) opts.debug_output = var;
|
||||
}
|
||||
|
||||
FILE *debug_output = nullptr;
|
||||
if (!opts.debug_output.empty()) {
|
||||
debug_output = fopen(opts.debug_output.c_str(), "w");
|
||||
|
||||
Reference in New Issue
Block a user