Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
3635d7cf
Commit
3635d7cf
authored
Jan 10, 2021
by
Marc Cornellà
Browse files
fix(universalarchive): make plugin zsh-only to fix `realpath` not found error
Fixes #9586
parent
c9bf8b4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/universalarchive/universalarchive.plugin.zsh
View file @
3635d7cf
...
@@ -10,28 +10,28 @@ Supported archive formats are:
...
@@ -10,28 +10,28 @@ Supported archive formats are:
tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
if
[[
$#
-lt
2
]]
;
then
if
[[
$#
-lt
2
]]
;
then
echo
>
&2
"
$usage
"
print
-u2
--
"
$usage
"
return
1
return
1
fi
fi
local
ext
=
"
$1
"
local
ext
=
"
$1
"
local
input
=
"
$
(
realpath
"
$2
"
)
"
local
input
=
"
$
{
2
:a
}
"
shift
shift
if
[[
!
-e
"
$input
"
]]
;
then
if
[[
!
-e
"
$input
"
]]
;
then
echo
>
&2
"
$input
not found"
print
-u2
--
"
$input
not found"
return
1
return
1
fi
fi
# generate output file name
# generate output file name
local
output
local
output
if
[[
$#
-gt
1
]]
;
then
if
[[
$#
-gt
1
]]
;
then
output
=
"
$
(
basename
"
${
input
%/*
}
"
)
"
output
=
"
$
{
input
:h:t
}
"
elif
[[
-f
"
$input
"
]]
;
then
elif
[[
-f
"
$input
"
]]
;
then
output
=
"
$
(
basename
"
${
input
%.[^.]*
}
"
)
"
output
=
"
$
{
input
:r:t
}
"
elif
[[
-d
"
$input
"
]]
;
then
elif
[[
-d
"
$input
"
]]
;
then
output
=
"
$(
basename
"
${
input
}
"
)
"
output
=
"
${
input
:t
}
"
fi
fi
# if output file exists, generate a random name
# if output file exists, generate a random name
...
@@ -44,7 +44,7 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
...
@@ -44,7 +44,7 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
# safety check
# safety check
if
[[
-f
"
$output
"
]]
;
then
if
[[
-f
"
$output
"
]]
;
then
echo
>
&2
"output file '
$output
' already exists. Aborting"
print
-u2
--
"output file '
$output
' already exists. Aborting"
return
1
return
1
fi
fi
...
@@ -65,6 +65,6 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
...
@@ -65,6 +65,6 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
Z
)
compress
-vcf
"
${
@
}
"
>
"
${
output
}
"
;;
Z
)
compress
-vcf
"
${
@
}
"
>
"
${
output
}
"
;;
zip
)
zip
-rull
"
${
output
}
"
"
${
@
}
"
;;
zip
)
zip
-rull
"
${
output
}
"
"
${
@
}
"
;;
zst
)
zstd
-c
-T0
"
${
@
}
"
>
"
${
output
}
"
;;
zst
)
zstd
-c
-T0
"
${
@
}
"
>
"
${
output
}
"
;;
*
)
echo
>
&2
"
$usage
"
;
return
1
;;
*
)
print
-u2
--
"
$usage
"
;
return
1
;;
esac
esac
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment