diff --git a/lastpass-cli-alfred-workflow.alfredworkflow b/lastpass-cli-alfred-workflow.alfredworkflow index 9a49c67..44e7933 100644 Binary files a/lastpass-cli-alfred-workflow.alfredworkflow and b/lastpass-cli-alfred-workflow.alfredworkflow differ diff --git a/workflow/info.plist b/workflow/info.plist index 667e23e..f9d7716 100644 --- a/workflow/info.plist +++ b/workflow/info.plist @@ -109,7 +109,12 @@ killall -9 lpass > /dev/null 2>&1 clear launchctl setenv LPASS_AGENT_TIMEOUT 28800 && export LPASS_AGENT_TIMEOUT=28800 -/usr/local/bin/lpass login --trust "your@email.com" && exit +for f in /usr/local/bin/lpass /opt/local/bin/lpass; do + if test -x $f; then + lpass_exec=$f + fi +done +$lpass_exec login --trust "your_email@example.com" && exit type alfred.workflow.action.terminalcommand @@ -175,7 +180,13 @@ if ($details[0] eq 'error-noinstall'){ exit 1; } else { -my $results = qx{/usr/local/bin/lpass show -c --username $details[1]}; +my $lpass_exec; +foreach my $f (qw@/usr/local/bin/lpass /opt/local/bin/lpass@) { + $lpass_exec = $f + if (-x $f); +} + +my $results = qx{$lpass_exec show -c --username $details[1]}; print $details[0]; } @@ -225,8 +236,16 @@ my ($agent, $agentErr, $agentErrCode) = capture { system('ps -ef | grep "lpass \[agent\]" | grep -v grep | grep -v "perl"'); }; +my $lpass_exec; +foreach my $f (qw@/usr/local/bin/lpass /opt/local/bin/lpass@) { + $lpass_exec = $f + if (-x $f); +} + my ($results, $err, $errorCode) = capture { - system('TERM=xterm-256color && /usr/local/bin/lpass sync && /usr/local/bin/lpass ls --sync=no | grep -i ' . $search); + system('TERM=xterm-256color && ' . + $lpass_exec . ' sync && ' . + $lpass_exec . ' ls --sync=no | grep -i ' . $search); }; print qq{<?xml version="1.0"?>\n<items>\n}; @@ -320,7 +339,13 @@ exit 0; exit 1; } else { -my $results = qx{/usr/local/bin/lpass show -c --password $details[1]}; +my $lpass_exec; +foreach my $f (qw@/usr/local/bin/lpass /opt/local/bin/lpass@) { + $lpass_exec = $f + if (-x $f); +} + +my $results = qx{$lpass_exec show -c --password $details[1]}; print $details[0]; } @@ -361,7 +386,13 @@ print $details[0]; escaping 127 script - /usr/local/bin/lpass logout --force + +for f in /usr/local/bin/lpass /opt/local/bin/lpass; do + if test -x $f; then + lpass_exec=$f + fi +done +$lpass_exec logout --force type 0