mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-22 12:43:23 +08:00
lib: deprecate refresh
function
With great power comes great responsibility. This function is somewhat low level, and is harmful to shell's user, as it completely screws up with job control (subprocesses). This PR officially marks `refresh` as deprecated, moving the deprecated functionality to omf plugin `compat` quarantine directory.
This commit is contained in:
parent
370913ec93
commit
37705618b2
|
@ -1,12 +0,0 @@
|
|||
# SYNOPSIS
|
||||
# refresh
|
||||
#
|
||||
# OVERVIEW
|
||||
# Refresh (reload) the current fish session.
|
||||
|
||||
function refresh -d "Refresh fish session by replacing current process"
|
||||
if not set -q CI
|
||||
history --save
|
||||
exec fish < /dev/tty
|
||||
end
|
||||
end
|
21
pkg/omf/functions/compat/refresh.fish
Normal file
21
pkg/omf/functions/compat/refresh.fish
Normal file
|
@ -0,0 +1,21 @@
|
|||
function refresh -d "(deprecated) Refresh fish session by replacing current process"
|
||||
echo (status -t)[5] | read -la caller
|
||||
printf 'warning: function %srefresh%s is deprecated and will be removed soon.\n' \
|
||||
(set_color -u) (set_color normal)
|
||||
|
||||
contains input $caller
|
||||
or echo $caller
|
||||
|
||||
set -q CI
|
||||
and return 0
|
||||
|
||||
type -q omf.core.reload
|
||||
and omf.core.reload
|
||||
|
||||
# If omf.core.reload exist, current fish will be replaced via exec, so
|
||||
# the code below will never be reached. When it doesn't exist, the code
|
||||
# below, the deprecated method, will be used as fallback.
|
||||
|
||||
history --save
|
||||
exec fish
|
||||
end
|
Loading…
Reference in New Issue
Block a user