Skip to content

Commit 1380dcf

Browse files
committed
mc-wrapper: fish shenanigans
fish is increasingly growing popularity, and has gained a lot of new interest after 4.0 version was released. There is obviously high chance that bunch of them are mc users, and would like to continue that trend also as fish users. Based on these observations, add mc-wrapper shenanigans for fish. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
1 parent 91b47d0 commit 1380dcf

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

contrib/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ mc-wrapper.csh: $(top_builddir)/config.status $(srcdir)/mc-wrapper.csh.in
2929
mc-wrapper.sh: $(top_builddir)/config.status $(srcdir)/mc-wrapper.sh.in
3030
$(SED) "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.sh.in > mc-wrapper.sh
3131

32+
mc-wrapper.sh: $(top_builddir)/config.status $(srcdir)/mc-wrapper.fish.in
33+
$(SED) "s%@""bindir@%$(bindir)%" $(srcdir)/mc-wrapper.fish.in > mc-wrapper.fish

contrib/mc-wrapper.fish.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
if set -q MC_TMPDIR
2+
set MC_PWD_FILE (mktemp "$MC_TMPDIR/mc.pwd.XXXXXX")
3+
else if set -q TMPDIR
4+
set MC_PWD_FILE (mktemp "$TMPDIR/mc.pwd.XXXXXX")
5+
else
6+
set MC_PWD_FILE (mktemp "/tmp/mc.pwd.XXXXXX")
7+
end
8+
9+
@bindir@/mc -P "$MC_PWD_FILE" "$argv"
10+
11+
if test -r "$MC_PWD_FILE"
12+
set MC_PWD (cat $MC_PWD_FILE)
13+
if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"
14+
cd "$MC_PWD"
15+
end
16+
set -e MC_PWD
17+
end
18+
19+
rm -f "$MC_PWD_FILE"
20+
set -e MC_PWD_FILE

0 commit comments

Comments
 (0)