From: <Z3...@us...> - 2012-09-13 12:02:55
|
Revision: 341 http://spd.svn.sourceforge.net/spd/?rev=341&view=rev Author: Z3po Date: 2012-09-13 12:02:44 +0000 (Thu, 13 Sep 2012) Log Message: ----------- fixed format of files and fixed delete call in spd-cli Modified Paths: -------------- trunk/src/spd-cli Modified: trunk/src/spd-cli =================================================================== --- trunk/src/spd-cli 2012-08-06 13:38:18 UTC (rev 340) +++ trunk/src/spd-cli 2012-09-13 12:02:44 UTC (rev 341) @@ -30,63 +30,65 @@ pp = spdCore.name(sys.argv[0]) # {{{ OptionParser stuff -parser = OptionParser( "%prog [Options] Search", - description = pp.acronym + ' - ' + pp.name, - version = version, - epilog = "With no parameters it will print out everything!") +parser = OptionParser( "%prog [Options] Search", + description = pp.acronym + ' - ' + pp.name, + 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( "-d", "--delete", + action="store_true", + metavar="Keywords", + dest ="delete", + default=False, + help ="Entries to delete") -parser.add_option( "-e", "--edit", - metavar="ID", - dest ="edit", - help ="ID to edit") +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( "-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( "--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( "-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( "--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( "-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( "-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( "-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") +parser.add_option( "--passfile", + dest = "passfile", + help = "do not use the confgured passfile but the one given here") (options, args) = parser.parse_args() # }}} @@ -98,53 +100,53 @@ # check if it is a search or not. if options.add: - pc.addEntry(interface.newEntry(pc.getCollumns())) - pc.exportPasswordsPlain() + pc.addEntry(interface.newEntry(pc.getCollumns())) + pc.exportPasswordsPlain() elif options.edit: - updates = interface.editEntry(pc.findPassword(options.edit,id=True)) - pc.updateEntry(updates) - pc.exportPasswordsPlain() + updates = interface.editEntry(pc.findPassword(options.edit,id=True)) + pc.updateEntry(updates) + pc.exportPasswordsPlain() elif options.addcollumn: - pc.addCollumn(options.addcollumn) - pc.exportPasswordsPlain() + pc.addCollumn(options.addcollumn) + pc.exportPasswordsPlain() elif options.delete: - searchPatterns = args - pc.delEntry(searchPatterns) - pc.exportPasswordsPlain() + searchPatterns = args + pc.delEntry(searchPatterns) + pc.exportPasswordsPlain() elif options.deleteID: - id = options.deleteID - pc.delEntry('nix', id=id) - pc.exportPasswordsPlain() + id = options.deleteID + pc.delEntry('nix', id=id) + pc.exportPasswordsPlain() elif options.pwonly: - searchPatterns = args - try: - if options.id: - print pc.findPassword(options.id,id=True)[pc.passwordField][0] - else: - print pc.findPassword(searchPatterns)[pc.passwordField][0] - except: - pass + searchPatterns = args + try: + if options.id: + print pc.findPassword(options.id,id=True)[pc.passwordField][0] + else: + print pc.findPassword(searchPatterns)[pc.passwordField][0] + except: + pass elif options.widemode: - searchPatterns = args - if options.id: - interface.tableOutput(pc.findPassword(options.id,id=True)) - else: - interface.tableOutput(pc.findPassword(searchPatterns)) + searchPatterns = args + if options.id: + interface.tableOutput(pc.findPassword(options.id,id=True)) + else: + interface.tableOutput(pc.findPassword(searchPatterns)) else: # regular search - searchPatterns = args - if options.id: - interface.listOutput(pc.findPassword(options.id,id=True)) - else: - interface.listOutput(pc.findPassword(searchPatterns)) + searchPatterns = args + if options.id: + interface.listOutput(pc.findPassword(options.id,id=True)) + else: + interface.listOutput(pc.findPassword(searchPatterns)) # EOF -# vim:foldmethod=marker:tabstop=3:autoindent:shiftwidth=3 +# vim:filetype=python:foldmethod=marker:autoindent:expandtab:tabstop=4 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |