Skip to content

Commit

Permalink
chore: add compatible for perl without Cwd-module
Browse files Browse the repository at this point in the history
  • Loading branch information
zthxxx committed Jul 11, 2024
1 parent 00c7dfe commit 8f3d307
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zsh-history-enquirer",
"version": "1.3.0",
"version": "1.3.1",
"description": "zsh history search plugin by enquirer",
"repository": "zthxxx/zsh-history-enquirer",
"publishConfig": {
Expand Down
10 changes: 9 additions & 1 deletion scripts/postinstall.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ mkdir -p ${plugins_dir}/${package_name}

ln -fs "`pwd`/${package_name}.plugin.zsh" "${plugins_dir}/${package_name}/"

is-command() { command -v $@ &> /dev/null; }

# it's same as `realpath`, but `realpath` is GNU only and not builtin
prel-realpath() {
perl -MCwd -e 'print Cwd::realpath($ARGV[0]),qq<\n>' $1
if is-command realpath; then
realpath $1
elif is-command readlink; then
readlink -f $1
else
perl -MCwd -e 'print Cwd::realpath($ARGV[0]),qq<\n>' $1
fi
}

local zsh_config_file="$(prel-realpath ${HOME}/.zshrc)"
Expand Down
1 change: 0 additions & 1 deletion tests/zsh-widget.test.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ZDOTDIR="`pwd`/tests/testing-home" \
expect -c '
spawn -noecho zsh -il
stty raw
set timeout 20
set ESC "\u001b\["
Expand Down

0 comments on commit 8f3d307

Please sign in to comment.