From: <Z3...@us...> - 2010-09-07 16:08:46
|
Revision: 314 http://spd.svn.sourceforge.net/spd/?rev=314&view=rev Author: Z3po Date: 2010-09-07 16:08:32 +0000 (Tue, 07 Sep 2010) Log Message: ----------- started to seperate CLI from INTERFACE because it also could be GUI or anything like. Modified Paths: -------------- branches/spd-ng/src/spdCLI.py branches/spd-ng/src/spdInterface.py Modified: branches/spd-ng/src/spdCLI.py =================================================================== --- branches/spd-ng/src/spdCLI.py 2010-09-05 17:06:04 UTC (rev 313) +++ branches/spd-ng/src/spdCLI.py 2010-09-07 16:08:32 UTC (rev 314) @@ -1,6 +1,7 @@ #!/usr/bin/python import string +from optparse import OptionParser class CLI(object): # {{{ """This is the CLI Module. @@ -49,6 +50,72 @@ return Entry # }}} + def getParser(self,version): # {{{ + parser = OptionParser( "%prog [Options] [Keywords]", + description = "SPD - Simple Password Displayer", + version = version, + epilog = "With no parameters it will print out everything!") + + #parser.add_option( "-d", "--delete", + # metavar="Keywords", + # dest ="delete", + # help ="Entries to delete") + # + #parser.add_option( "-e", "--edit", + # metavar="ID", + # dest ="edit", + # help ="ID to edit") + # + #parser.add_option( "-i", "--delete-id", + # metavar="ID", + # dest ="deleteID", + # help ="ID to delete") + # + #parser.add_option( "--id", + # dest ="id", + # help ="Show Password by ID") + # + parser.add_option( "-a", "--add", + action="store_true", + dest = "add", + default=False, + help = "Add an Entry") + + #parser.add_option( "--add-collumn", + # metavar="Collumn", + # dest = "addcollumn", + # default=False, + # help = "Add a Collumn to Passfile") + # + #parser.add_option( "-p", "--password-only", + # action="store_true", + # dest = "pwonly", + # default=False, + # help = "print Password only of first match, usefull for piping (e.g. in rdesktop)") + # + #parser.add_option( "-w", "--wide", + # action="store_true", + # dest = "widemode", + # default=False, + # help = "print output in wide mode (means as a table)") + # + #parser.add_option( "-l", "--local", + # action="store_true", + # dest = "localStore", + # default=False, + # help = "do not operate on the configured RCS, only use the local password container") + # + #parser.add_option( "--passfile", + # dest = "passfile", + # help = "do not use the confgured passfile but the one given here") + + return parser + # }}} + + def main(self,options,args): # {{{ + pass + # }}} + # }}} # EOF Modified: branches/spd-ng/src/spdInterface.py =================================================================== --- branches/spd-ng/src/spdInterface.py 2010-09-05 17:06:04 UTC (rev 313) +++ branches/spd-ng/src/spdInterface.py 2010-09-07 16:08:32 UTC (rev 314) @@ -52,76 +52,22 @@ self.core.addEntry(Entry) # }}} -# }}} + def main(self,version): # {{{ + parser = self.client.getParser(version) -# {{{ OptionParser stuff -parser = OptionParser( "%prog [Options] [Keywords]", - description = "SPD - Simple Password Displayer", - version = version, - epilog = "With no parameters it will print out everything!") + (options, args) = parser.parse_args() -#parser.add_option( "-d", "--delete", -# metavar="Keywords", -# dest ="delete", -# help ="Entries to delete") -# -#parser.add_option( "-e", "--edit", -# metavar="ID", -# dest ="edit", -# help ="ID to edit") -# -#parser.add_option( "-i", "--delete-id", -# metavar="ID", -# dest ="deleteID", -# help ="ID to delete") -# -#parser.add_option( "--id", -# dest ="id", -# help ="Show Password by ID") -# -parser.add_option( "-a", "--add", - action="store_true", - dest = "add", - default=False, - help = "Add an Entry") + if options.add: + interface.addEntry() + + interface.findPasswords(args) + # }}} -#parser.add_option( "--add-collumn", -# metavar="Collumn", -# dest = "addcollumn", -# default=False, -# help = "Add a Collumn to Passfile") -# -#parser.add_option( "-p", "--password-only", -# action="store_true", -# dest = "pwonly", -# default=False, -# help = "print Password only of first match, usefull for piping (e.g. in rdesktop)") -# -#parser.add_option( "-w", "--wide", -# action="store_true", -# dest = "widemode", -# default=False, -# help = "print output in wide mode (means as a table)") -# -#parser.add_option( "-l", "--local", -# action="store_true", -# dest = "localStore", -# default=False, -# help = "do not operate on the configured RCS, only use the local password container") -# -#parser.add_option( "--passfile", -# dest = "passfile", -# help = "do not use the confgured passfile but the one given here") - -(options, args) = parser.parse_args() # }}} interface = Interface() +interface.main(version) -if options.add: - interface.addEntry() - -interface.findPasswords(args) # EOF # vim:foldmethod=marker:tabstop=3:autoindent:shiftwidth=3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |