Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info.plist: allow for ports-installed lpass #4

Merged
merged 1 commit into from
Aug 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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