abbr: Make show output actually work

This would print

```
abbr -a -- dotdot --regex ^\\.\\.+\$ --function multicd
```

which expands "dotdot" to "--regex ^\\.\\.+\$...".

Instead, we move the name to right before the replacement, and move
the `--` before that:

```
abbr -a --regex ^\\.\\.+\$ --function -- dotdot multicd
```

It might be possible to improve that, but this at least round-trips.
This commit is contained in:
Fabian Boehm
2022-12-13 19:38:58 +01:00
parent aca8c52660
commit 30a37d9433
2 changed files with 6 additions and 6 deletions

View File

@@ -158,7 +158,7 @@ abbr --add nonregex_name foo
abbr --add regex_name --regex 'A[0-9]B' bar
abbr --show
# CHECK: abbr -a -- nonregex_name foo
# CHECK: abbr -a -- regex_name --regex 'A[0-9]B' bar
# CHECK: abbr -a --regex 'A[0-9]B' -- regex_name bar
abbr --erase (abbr --list)
abbr --add bogus --position never stuff