#============================================================================ # This file is part of Pwman3. # # Pwman3 is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2 # as published by the Free Software Foundation; # # Pwman3 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 Pwman3; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #============================================================================ # Copyright (C) 2013 Oz Nahum #============================================================================ # pylint: disable=I0011 """ Define the base CLI interface for pwman3 """ from __future__ import print_function from pwman.util.crypto import CryptoEngine from pwman.util.crypto import zerome import pwman.util.config as config import re import sys import os import time import select as uselect import ast from pwman.util.config import get_pass_conf from pwman.ui import tools from pwman.ui.tools import CliMenuItem from colorama import Fore from pwman.data.nodes import NewNode from pwman.ui.tools import CMDLoop import getpass from pwman.data.tags import TagNew class HelpUI(object): # pragma: no cover """ this class holds all the UI help functionality. in PwmanCliNew. The later inherits from this class and allows it to print help messages to the console. """ def usage(self, string): print ("Usage: %s" % (string)) def help_open(self): self.usage("open ") print ("Launch default browser with 'xdg-open url',\n", "the url must contain http:// or https://.") def help_o(self): self.help_open() def help_copy(self): self.usage("copy ") print ("Copy password to X clipboard (xsel required)") def help_cp(self): self.help_copy() def help_cls(self): self.usage("cls") print ("Clear the Screen from information.") def help_list(self): self.usage("list ...") print ("List nodes that match current or specified filter.", " l is an alias.") def help_EOF(self): self.help_exit() def help_delete(self): self.usage("delete ...") print ("Deletes nodes. rm is an alias.") self._mult_id_help() def help_h(self): self.help_help() def help_help(self): self.usage("help [topic]") print ("Prints a help message for a command.") def help_e(self): self.help_edit() def help_n(self): self.help_new() def help_p(self): self.help_print() def help_l(self): self.help_list() def help_edit(self): self.usage("edit ... ") print ("Edits a nodes.") self._mult_id_help() def help_import(self): self.usage("import [filename] ...") print ("Not implemented...") def help_export(self): self.usage("export ... ") print ("Exports a list of ids to an external format. If no IDs or", " tags are specified, then all nodes under the current", " filter are exported.") self._mult_id_help() def help_new(self): self.usage("new") print ("Creates a new node.,", "You can override default config settings the following way:\n", "pwman> n {'leetify':False, 'numerics':True}") def help_rm(self): self.help_delete() def help_print(self): self.usage("print ...") print ("Displays a node. ") self._mult_id_help() def _mult_id_help(self): print("Multiple ids and nodes can be specified, separated by a space.", " A range of ids can be specified in the format n-N. e.g. ", " '10-20' would specify all nodes having ids from 10 to 20 ", " inclusive. Tags are considered one-by-one. e.g. 'foo 2 bar'", " would yield to all nodes with tag 'foo', node 2 and all ", " nodes with tag 'bar'.") def help_exit(self): self.usage("exit") print("Exits the application.") def help_save(self): self.usage("save [filename]") print("Saves the current configuration to [filename]. If no filename ", "is given, the configuration is saved to the file from which ", "the initial configuration was loaded.") def help_set(self): self.usage("set [configoption] [value]") print("Sets a configuration option. If no value is specified, the ", "current value for [configoption] is output. If neither ", "[configoption] nor [value] are specified, the whole current ", "configuration is output. [configoption] must be of the ", "format
.