Pārlūkot izejas kodu

Allow printing one node to the console

fix #50
Oz N Tiram 7 gadi atpakaļ
vecāks
revīzija
ad539b34dc
2 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 4 0
      pwman/__init__.py
  2. 4 0
      pwman/ui/cli.py

+ 4 - 0
pwman/__init__.py

@@ -83,6 +83,10 @@ def parser_options(formatter_class=argparse.HelpFormatter):  # pragma: no cover
     parser.add_argument('-d', '--database', dest='dbase')
     parser.add_argument('-i', '--import', nargs=2, dest='file_delim',
                         help="Specify the file name and the delimeter type")
+    subparsers = parser.add_subparsers(help='commands', dest="cmd")
+
+    printer = subparsers.add_parser('p', help='print password entry')
+    printer.add_argument("node", type=int)
     return parser
 
 

+ 4 - 0
pwman/ui/cli.py

@@ -134,6 +134,10 @@ def main():
 
     cli = PwmanCli(db, xselpath, CLICallback, config)
 
+    if args.cmd == "p":
+        cli.onecmd("p %s" % args.node)
+        sys.exit(1)
+
     try:
         cli.cmdloop()
     except KeyboardInterrupt as e: