Skip to content

Commit

Permalink
Merge pull request #4 from jsquyres/pr/we-love-macports-too
Browse files Browse the repository at this point in the history
info.plist: allow for ports-installed lpass
  • Loading branch information
stuartcryan committed Aug 8, 2015
2 parents b648fc4 + 0966b9f commit b7af05f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
Binary file modified lastpass-cli-alfred-workflow.alfredworkflow
Binary file not shown.
41 changes: 36 additions & 5 deletions workflow/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@
<string>killall -9 lpass &gt; /dev/null 2&gt;&amp;1
clear
launchctl setenv LPASS_AGENT_TIMEOUT 28800 &amp;&amp; export LPASS_AGENT_TIMEOUT=28800
/usr/local/bin/lpass login --trust "your@email.com" &amp;&amp; exit</string>
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" &amp;&amp; exit</string>
</dict>
<key>type</key>
<string>alfred.workflow.action.terminalcommand</string>
Expand Down Expand Up @@ -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];
}</string>
Expand Down Expand Up @@ -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 &amp;&amp; /usr/local/bin/lpass sync &amp;&amp; /usr/local/bin/lpass ls --sync=no | grep -i ' . $search);
system('TERM=xterm-256color &amp;&amp; ' .
$lpass_exec . ' sync &amp;&amp; ' .
$lpass_exec . ' ls --sync=no | grep -i ' . $search);
};
print qq{&lt;?xml version="1.0"?&gt;\n&lt;items&gt;\n};
Expand Down Expand Up @@ -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];
}</string>
Expand Down Expand Up @@ -361,7 +386,13 @@ print $details[0];
<key>escaping</key>
<integer>127</integer>
<key>script</key>
<string>/usr/local/bin/lpass logout --force</string>
<string>
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</string>
<key>type</key>
<integer>0</integer>
</dict>
Expand Down

0 comments on commit b7af05f

Please sign in to comment.