From ed5e1cd8f9486848d0871917f62bee015f6666dd Mon Sep 17 00:00:00 2001 From: Derek Stavis <dekestavis@gmail.com> Date: Tue, 23 Feb 2016 22:17:22 -0300 Subject: [PATCH] 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. --- lib/refresh.fish | 12 ------------ pkg/omf/functions/compat/refresh.fish | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 lib/refresh.fish create mode 100644 pkg/omf/functions/compat/refresh.fish diff --git a/lib/refresh.fish b/lib/refresh.fish deleted file mode 100644 index d6b8dce..0000000 --- a/lib/refresh.fish +++ /dev/null @@ -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 diff --git a/pkg/omf/functions/compat/refresh.fish b/pkg/omf/functions/compat/refresh.fish new file mode 100644 index 0000000..261a183 --- /dev/null +++ b/pkg/omf/functions/compat/refresh.fish @@ -0,0 +1,14 @@ +function refresh -d "(deprecated) Refresh fish session by replacing current process" + printf 'warning: function %srefresh%s is deprecated and will be removed soon.\n %s\n' \ + (set_color -u) (set_color normal) \ + (status -t)[5] >&2 + + set -q CI + and return 0 + + type -q omf.core.reload + and omf.core.reload + + history --save + exec fish +end -- GitLab