lastpass/lastpass-cli — pull request #17 by ianonavy (2014-10-23 11:01:03+00:00)
Title: Add find command.

I wanted to use the lpass command to make a userscript for dwb, but I found no
way to query an account from a URL. So I added it.

Here is the commit message:

The find command allows users to search for an account using a URL. One
use case for this is a custom userscript for a browser like dwb that
contextually fills in forms in the same manner as the official LastPass
browser extensions.

The syntax is as follows:

lpass find URL

Matching ignores http vs. https and takes the first account such that
the passed URL starts with the account's URL. The order of searching is
the same as "lpass ls" (oldest entries first). The command errors if it
fails to find a matching account, and it ignores situations where
multiple accounts match the same input URL.

Future improvements could include:
- An optional flag for ignoring http vs. https
- Support for matching 'example.com' with 'www.example.com';
- Some order of precedent for matching rules. For example, for the query
'example.com', match an account 'example.com' or 'example.com/?extra'
or 'www.example.com'; in order according certain rules.
- Support for searching via other parameters (e.g. the name attributes
found from forms on the page)