CLI API¶
Main CLI Application¶
dbcreds.cli.app = typer.Typer(name='dbcreds', help='Professional database credentials management', add_completion=True, rich_markup_mode='rich')
module-attribute
¶
Commands¶
dbcreds.cli.init()
¶
Initialize dbcreds configuration.
dbcreds.cli.add(name: str = typer.Argument(..., help='Environment name (e.g., dev, staging, prod)'), db_type: DatabaseType = typer.Option(DatabaseType.POSTGRESQL, '--type', '-t', help='Database type', case_sensitive=False), host: Optional[str] = typer.Option(None, '--host', '-h', help='Database host'), port: Optional[int] = typer.Option(None, '--port', '-p', help='Database port'), database: Optional[str] = typer.Option(None, '--database', '-d', help='Database name'), username: Optional[str] = typer.Option(None, '--username', '-u', help='Database username'), description: Optional[str] = typer.Option(None, '--description', help='Environment description'), production: bool = typer.Option(False, '--production', help='Mark as production environment'), expires_days: int = typer.Option(90, '--expires-days', help='Password expiry in days'))
¶
Add a new database environment.
dbcreds.cli.list()
¶
List all configured environments.
dbcreds.cli.show(name: str = typer.Argument(..., help='Environment name'), show_password: bool = typer.Option(False, '--password', help='Show password'))
¶
Show details for a specific environment.
dbcreds.cli.test(name: str = typer.Argument(..., help='Environment name'))
¶
Test database connection for an environment.
dbcreds.cli.remove(name: str = typer.Argument(..., help='Environment name'), force: bool = typer.Option(False, '--force', '-f', help='Skip confirmation'))
¶
Remove an environment and its credentials.
dbcreds.cli.update(name: str = typer.Argument(..., help='Environment name'), password: bool = typer.Option(False, '--password', help='Update password only'), expires_days: Optional[int] = typer.Option(None, '--expires-days', help='Update password expiry'))
¶
Update credentials for an environment.
dbcreds.cli.check()
¶
Check for expiring or expired passwords.
dbcreds.cli.export(name: str = typer.Argument(..., help='Environment name'), format: str = typer.Option('uri', '--format', '-f', help='Export format (uri, env, json)'), include_password: bool = typer.Option(True, '--include-password', help='Include password'))
¶
Export connection details for an environment.