MCPcopy Index your code
hub / github.com/dbcli/mycli / get_password_from_file

Function get_password_from_file

mycli/main.py:334–351  ·  view source on GitHub ↗
(password_file: str | None)

Source from the content-addressed store, hash-verified

332
333
334def get_password_from_file(password_file: str | None) -> str | None:
335 if not password_file:
336 return None
337 try:
338 with open(password_file) as fp:
339 return fp.readline().removesuffix('\n')
340 except FileNotFoundError:
341 click.secho(f"Password file '{password_file}' not found", err=True, fg='red')
342 sys.exit(1)
343 except PermissionError:
344 click.secho(f"Permission denied reading password file '{password_file}'", err=True, fg='red')
345 sys.exit(1)
346 except IsADirectoryError:
347 click.secho(f"Path '{password_file}' is a directory, not a file", err=True, fg='red')
348 sys.exit(1)
349 except Exception as e:
350 click.secho(f"Error reading password file '{password_file}': {str(e)}", err=True, fg='red')
351 sys.exit(1)
352
353
354def preprocess_cli_args(

Calls 1

exitMethod · 0.80