mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-26 07:41:15 -03:00
Add feature flag to turn off %self (#10262)
This is the last remnant of the old percent expansion. It has the downsides of it, in that it is annoying to combine with anything: ```fish echo %self/foo ``` prints "%self/foo", not fish's pid. We have introduced $fish_pid in 3.0, which is much easier to use - just like a variable, because it is one. If you need backwards-compatibility for < 3.0, you can use the following shim: ```fish set -q fish_pid or set -g fish_pid %self ``` So we introduce a feature-flag called "remove-percent-self" to turn it off. "%self" will simply not be special, e.g. `echo %self` will print "%self".
This commit is contained in:
4
tests/checks/features-percent-self1.fish
Normal file
4
tests/checks/features-percent-self1.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
#RUN: %fish --features=remove-percent-self %s
|
||||
|
||||
echo %self
|
||||
# CHECK: %self
|
||||
2
tests/checks/features-percent-self2.fish
Normal file
2
tests/checks/features-percent-self2.fish
Normal file
@@ -0,0 +1,2 @@
|
||||
#RUN: %fish --features 'remove-percent-self' -c 'status test-feature remove-percent-self; echo remove-percent-self: $status'
|
||||
# CHECK: remove-percent-self: 0
|
||||
@@ -57,6 +57,7 @@ status features
|
||||
#CHECK: qmark-noglob on 3.0 ? no longer globs
|
||||
#CHECK: regex-easyesc on 3.1 string replace -r needs fewer \'s
|
||||
#CHECK: ampersand-nobg-in-token on 3.4 & only backgrounds if followed by a separator
|
||||
#CHECK: remove-percent-self off 3.8 %self is no longer expanded (use $fish_pid)
|
||||
status test-feature stderr-nocaret
|
||||
echo $status
|
||||
#CHECK: 0
|
||||
|
||||
Reference in New Issue
Block a user