MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / do_read_password

Method do_read_password

examples/read_input.py:102–112  ·  view source on GitHub ↗

Call read_secret to read a password without displaying it while being typed. WARNING: Password will be displayed for verification after it is typed.

(self, _)

Source from the content-addressed store, hash-verified

100
101 @cmd2.with_category(EXAMPLE_COMMANDS)
102 def do_read_password(self, _) -> None:
103 """Call read_secret to read a password without displaying it while being typed.
104
105 WARNING: Password will be displayed for verification after it is typed.
106 """
107 self.poutput("The input will not be displayed on the screen")
108 try:
109 password = self.read_secret("Password: ")
110 self.poutput(f"You entered: {password}")
111 except EOFError:
112 pass
113
114 def do_eat(self, arg):
115 """Example of using the select method for reading multiple choice input.

Callers

nothing calls this directly

Calls 2

poutputMethod · 0.80
read_secretMethod · 0.80

Tested by

no test coverage detected