abbr: Erase the old universal variable with abbr --erase

This means cleaning out old universal variables is now just:

```fish
abbr --erase (abbr --list)
```

which makes upgrading much easier.

Note that this erases the currently defined variable and/or any
universal. It doesn't stop at the former because that makes it *easy*
to remove the universals (no running `abbr --erase` twice), and it
doesn't care about globals because, well, they would be gone on
restart anyway.

Fixes #9468.
This commit is contained in:
Fabian Boehm
2023-01-13 16:07:50 +01:00
parent 27952db9f7
commit 572a568268
2 changed files with 21 additions and 2 deletions

View File

@@ -170,6 +170,16 @@ abbr --show
# CHECK: abbr -a -- nonregex_name foo
# CHECK: abbr -a --regex 'A[0-9]B' -- regex_name bar
# CHECK: abbr -a --position anywhere --function replace_history -- !!
# Confirm that this erases the old uvar
# (slightly cheating since we haven't imported it as an abbr,
# but that's okay)
abbr --erase cuckoo
echo erase $status
# CHECK: erase 0
set --show _fish_abbr_cuckoo
# Nothing
abbr --erase (abbr --list)
abbr --add bogus --position never stuff