summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclab26
1 files changed, 26 insertions, 0 deletions
diff --git a/clab b/clab
index 26ada94..d47700a 100755
--- a/clab
+++ b/clab
@@ -87,6 +87,12 @@ class AddressBook(object):
class CommandLineAddressBook(cliapp.Application):
+ cmd_synopsis = {
+ 'list': '',
+ 'find': '[PATTERN...]',
+ 'mutt-query': '[PATTERN...]',
+ }
+
def add_settings(self):
self.settings.string_list(
['database', 'db', 'd'],
@@ -101,16 +107,36 @@ class CommandLineAddressBook(cliapp.Application):
return book
def cmd_list(self, args):
+ '''List all entries in the database.
+
+ This lists all the entries. See the find subcommand for
+ searching specific entries.
+
+ '''
book = self.load_address_book()
for entry in book.entries:
self.output.write(entry.as_yaml() + '\n')
def cmd_find(self, args):
+ '''List entries that match patterns.
+
+ Each pattern is a fixed string (not a regular expression).
+ Matching is for any text in the entry.
+
+ '''
+
book = self.load_address_book()
for entry in book.find(args):
self.output.write(entry.as_yaml() + '\n')
def cmd_mutt_query(self, args):
+ '''Find entries for use with mutt.
+
+ This is like the find subcommand, but output is formatted
+ so it's suitable for the mutt query hook.
+
+ '''
+
if len(args) != 1:
raise cliapp.AppException(
'mutt-query requires exactly one argument')