mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Relnoted history builtin
Tweaked validation regex to use extended regexs
This commit is contained in:
parent
85cbb943b5
commit
be1d216b34
@ -22,6 +22,18 @@ li {
|
|||||||
<li>A SIGTERM now ends the whole execution stack again (<a href="https://github.com/ridiculousfish/fishfish/issues/13">from this issue</a>).
|
<li>A SIGTERM now ends the whole execution stack again (<a href="https://github.com/ridiculousfish/fishfish/issues/13">from this issue</a>).
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>New Features</h3>
|
||||||
|
<ul>
|
||||||
|
<li>A <b>history builtin</b>, and associated interactive function that enables deleting history items. Example usage:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Print all history items beginning with echo: <span class="mono">history --search --prefix echo</span></li>
|
||||||
|
<li>Print all history items containing foo: <span class="mono">history --search --contains foo</span></li>
|
||||||
|
<li>Interactively delete some items containing foo: <span class="mono">history --delete --contains foo</span></li>
|
||||||
|
</ul><br>
|
||||||
|
Credit to Siteshwar for implementation. Thanks Siteshwar!
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ function history --description "Deletes an item from history"
|
|||||||
end
|
end
|
||||||
|
|
||||||
read --local --prompt "echo 'Delete which entries? > '" choice
|
read --local --prompt "echo 'Delete which entries? > '" choice
|
||||||
set choice (echo $choice | tr " " "\n")
|
set choice (echo $choice | tr " " "\n")
|
||||||
|
|
||||||
for i in $choice
|
for i in $choice
|
||||||
|
|
||||||
# Skip empty input; for example, if the user just hits return
|
# Skip empty input; for example, if the user just hits return
|
||||||
@ -63,7 +63,7 @@ function history --description "Deletes an item from history"
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Following two validations could be embedded with "and" but I find the syntax kind of weird.
|
#Following two validations could be embedded with "and" but I find the syntax kind of weird.
|
||||||
if not echo $i | grep -q "^[0-9]+\$"
|
if not echo $i | grep -E -q "^[0-9]+\$"
|
||||||
printf "Invalid input: %s\n" $i
|
printf "Invalid input: %s\n" $i
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user