|
@@ -21,10 +21,7 @@
|
|
|
Define the base CLI interface for pwman3
|
|
|
"""
|
|
|
from __future__ import print_function
|
|
|
-from pwman.util.crypto_engine import zerome
|
|
|
import sys
|
|
|
-from pwman.ui.tools import CliMenuItem
|
|
|
-from pwman.ui.tools import CMDLoop
|
|
|
|
|
|
if sys.version_info.major > 2:
|
|
|
raw_input = input
|
|
@@ -151,164 +148,6 @@ class HelpUIMixin(object): # pragma: no cover
|
|
|
print("Displays all tags in used in the database.")
|
|
|
|
|
|
|
|
|
-class BaseCommands(object):
|
|
|
- """
|
|
|
- Inherit from the old class, override
|
|
|
- all the methods related to tags, and
|
|
|
- newer Node format, so backward compatability is kept...
|
|
|
- Commands defined here, can have aliases definded in Aliases.
|
|
|
- You can define the aliases here too, but it makes
|
|
|
- the class code really long and unclear.
|
|
|
- """
|
|
|
-
|
|
|
- def do_edit(self, arg, menu=None):
|
|
|
- ids = self.get_ids(arg)
|
|
|
- for i in ids:
|
|
|
- try:
|
|
|
- i = int(i)
|
|
|
- node = self._db.getnodes([i])[0]
|
|
|
- if not menu:
|
|
|
- menu = CMDLoop()
|
|
|
- print ("Editing node %d." % (i))
|
|
|
-
|
|
|
- menu.add(CliMenuItem("Username", self.get_username,
|
|
|
- node.username,
|
|
|
- node.username))
|
|
|
- menu.add(CliMenuItem("Password", self.get_password,
|
|
|
- node.password,
|
|
|
- node.password))
|
|
|
- menu.add(CliMenuItem("Url", self.get_url,
|
|
|
- node.url,
|
|
|
- node.url))
|
|
|
- menunotes = CliMenuItem("Notes", self.get_notes,
|
|
|
- node.notes,
|
|
|
- node.notes)
|
|
|
- menu.add(menunotes)
|
|
|
- menu.add(CliMenuItem("Tags", self.get_tags,
|
|
|
- node.tags,
|
|
|
- node.tags))
|
|
|
- menu.run(node)
|
|
|
- self._db.editnode(i, node)
|
|
|
-
|
|
|
- zerome(node._password)
|
|
|
- except Exception as e:
|
|
|
- self.error(e)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
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