mc/mc.fish
Adam Majer 926281aa2b - Include review comments: don't depend on fish.
- Add 4258-fish-subshell-prompt.patch fixing
  https://midnight-commander.org/ticket/4258 stopping fish from sending
  \r while printing prompt and mc erases prompt buffer.
- Add mc.fish, which the fish equivalent of /usr/share/mc/mc-wrapper.sh

OBS-URL: https://build.opensuse.org/package/show/Base:System/mc?expand=0&rev=142
2022-06-28 08:09:11 +00:00

26 lines
788 B
Fish

function mc --description='Midnight Commander'
set -q TMPDIR || set -gx TMPDIR /tmp
set -gx _fish_MC_PWD_FILE $TMPDIR/mc-(id -un)/mc.pwd.$fish_pid
command mc -P "$_fish_MC_PWD_FILE" $argv
if test -r $_fish_MC_PWD_FILE
set -gx _fish_MC_PWD (cat $_fish_MC_PWD_FILE)
if test -n $_fish_MC_PWD && test $_fish_MC_PWD != $PWD && test -d $_fish_MC_PWD
cd $_fish_MC_PWD
end
set -e _fish_MC_PWD
end
set -e _fish_MC_PWD_FILE
set -e _fish_MC_USER
function _remove_tmp --on-job-exit caller --inherit-variable _fish_MC_PWD_FILE
command rm $_fish_MC_PWD_FILE
set -f dirn (dirname $_fish_MC_PWD_FILE)
if test -d "$dirn"
rm -f $dirn
end
functions -e _remove_tmp
end
end