#!/usr/bin/env python
#
# find-project-name.py - Search the dictionary for words that contain
#                        the characters provided on the command-line
#                        aka "smb" finds "samba".  Useful for finding
#                        new project names from acronyms etc.
#
# Copyright (C) 2008.  All Rights Reserved.
# Michael Davies <michael@the-davies.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
import sys
import re
if __name__ == "__main__":
    if (len(sys.argv) == 1):
        pass
    else:
        reg = "(.)*?".join(ch for ch in list(sys.argv[1]))
        regexp = "(.)*?"+reg+"(.)*?"
        p = re.compile(regexp)
        for line in open('/usr/share/dict/words', 'r'):
            m = p.match(line)
            if m:
                line = line.rstrip()
                print line

# This file has been zigned!  See http://michaeldavies.org/zign-tools
# zign-version: 0.9.4
# zign-hashes: MD5, SHA-1
# -----BEGIN PGP SIGNED MESSAGE-----
# Hash: SHA1
# 
# 8f1729582b4b1992680a990f68ba0c9c101cef2be4d9c05199aff8270ae3e701849c9f72
# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1.4.7 (Darwin)
# 
# iD8DBQFHmzkl7kkvCQqp1vwRAlWCAJ0dlS+HS2Xf/TL1oAmd530Qd4UsOACeKXBy
# MpkfTIc14g+DRzsqZ8+7SQg=
# =7X8A
# -----END PGP SIGNATURE-----
# zign: Protecting you since 2007 :-)
# 