Change fish_trace prefix to "->" instead of plusses

This matches what we do in --profile's output:

```
> source /home/alfa/.config/fish/config.fish
--> set -gx XDG_CACHE_HOME /home/alfa/.cache
--> set -gx XDG_CONFIG_HOME /home/alfa/.config
--> set -gx XDG_DATA_HOME /home/alfa/.local/share
```

instead of

```
+ source /home/alfa/.config/fish/config.fish
+++ set -gx XDG_CACHE_HOME /home/alfa/.cache
+++ set -gx XDG_CONFIG_HOME /home/alfa/.config
+++ set -gx XDG_DATA_HOME /home/alfa/.local/share
```
This commit is contained in:
Fabian Homborg 2020-12-09 20:51:07 +01:00
parent 2aaa51e02e
commit 425dabd6b1
2 changed files with 29 additions and 28 deletions

View file

@ -19,7 +19,8 @@ bool trace_enabled(const parser_t &parser) {
void trace_argv(const parser_t &parser, const wchar_t *command, const wcstring_list_t &argv) {
// Format into a string to prevent interleaving with flog in other threads.
// Add the + prefix.
wcstring trace_text(parser.blocks().size(), '+');
wcstring trace_text(parser.blocks().size() - 1, L'-');
trace_text.push_back(L'>');
if (command && command[0]) {
trace_text.push_back(L' ');
@ -29,7 +30,7 @@ void trace_argv(const parser_t &parser, const wchar_t *command, const wcstring_l
trace_text.push_back(L' ');
trace_text.append(escape_string(arg, ESCAPE_ALL));
}
trace_text.push_back('\n');
trace_text.push_back(L'\n');
log_extra_to_flog_file(trace_text);
}

View file

@ -13,11 +13,11 @@ end
# CHECK: 2
# CHECK: 3
# CHECKERR: + for 1 2 3
# CHECKERR: ++ echo 1
# CHECKERR: ++ echo 2
# CHECKERR: ++ echo 3
# CHECKERR: + end for
# CHECKERR: > for 1 2 3
# CHECKERR: -> echo 1
# CHECKERR: -> echo 2
# CHECKERR: -> echo 3
# CHECKERR: > end for
while true
and true
@ -27,12 +27,12 @@ end
# CHECK: inside
# CHECKERR: + while
# CHECKERR: + true
# CHECKERR: + true
# CHECKERR: ++ echo inside
# CHECKERR: ++ break
# CHECKERR: + end while
# CHECKERR: > while
# CHECKERR: > true
# CHECKERR: > true
# CHECKERR: -> echo inside
# CHECKERR: -> break
# CHECKERR: > end while
while true && true
echo inside2
@ -41,12 +41,12 @@ end
# CHECK: inside2
# CHECKERR: + while
# CHECKERR: + true
# CHECKERR: + true
# CHECKERR: ++ echo inside2
# CHECKERR: ++ break
# CHECKERR: + end while
# CHECKERR: > while
# CHECKERR: > true
# CHECKERR: > true
# CHECKERR: -> echo inside2
# CHECKERR: -> break
# CHECKERR: > end while
if true && false
else if false || true
@ -56,17 +56,17 @@ end
# CHECK: inside3
# CHECKERR: + if
# CHECKERR: + true
# CHECKERR: + false
# CHECKERR: + else if
# CHECKERR: + false
# CHECKERR: + true
# CHECKERR: ++ echo inside3
# CHECKERR: + end if
# CHECKERR: > if
# CHECKERR: > true
# CHECKERR: > false
# CHECKERR: > else if
# CHECKERR: > false
# CHECKERR: > true
# CHECKERR: -> echo inside3
# CHECKERR: > end if
set -e fish_trace
# CHECKERR: + set -e fish_trace
# CHECKERR: > set -e fish_trace
echo untraced
# CHECK: untraced