(
self,
force_passwd_prompt=False,
never_passwd_prompt=False,
pgexecute=None,
pgclirc_file=None,
row_limit=None,
application_name="pgcli",
single_connection=False,
less_chatty=None,
prompt=None,
prompt_dsn=None,
auto_vertical_output=False,
warn=None,
ssh_tunnel_url: str | None = None,
log_file: str | None = None,
)
| 172 | os.environ["LESS"] = "-SRXF" |
| 173 | |
| 174 | def __init__( |
| 175 | self, |
| 176 | force_passwd_prompt=False, |
| 177 | never_passwd_prompt=False, |
| 178 | pgexecute=None, |
| 179 | pgclirc_file=None, |
| 180 | row_limit=None, |
| 181 | application_name="pgcli", |
| 182 | single_connection=False, |
| 183 | less_chatty=None, |
| 184 | prompt=None, |
| 185 | prompt_dsn=None, |
| 186 | auto_vertical_output=False, |
| 187 | warn=None, |
| 188 | ssh_tunnel_url: str | None = None, |
| 189 | log_file: str | None = None, |
| 190 | ): |
| 191 | self.force_passwd_prompt = force_passwd_prompt |
| 192 | self.never_passwd_prompt = never_passwd_prompt |
| 193 | self.pgexecute = pgexecute |
| 194 | self.dsn_alias = None |
| 195 | self.watch_command = None |
| 196 | |
| 197 | # Load config. |
| 198 | c = self.config = get_config(pgclirc_file) |
| 199 | |
| 200 | # at this point, config should be written to pgclirc_file if it did not exist. Read it. |
| 201 | self.config_writer = load_config(get_config_filename(pgclirc_file)) |
| 202 | |
| 203 | # make sure to use self.config_writer, not self.config |
| 204 | NamedQueries.instance = NamedQueries.from_config(self.config_writer) |
| 205 | |
| 206 | self.logger = logging.getLogger(__name__) |
| 207 | self.initialize_logging() |
| 208 | |
| 209 | self.set_default_pager(c) |
| 210 | self.output_file = None |
| 211 | self.pgspecial = PGSpecial() |
| 212 | |
| 213 | self.hide_named_query_text = "hide_named_query_text" in c["main"] and c["main"].as_bool("hide_named_query_text") |
| 214 | self.explain_mode = False |
| 215 | self.multi_line = c["main"].as_bool("multi_line") |
| 216 | self.multiline_mode = c["main"].get("multi_line_mode", "psql") |
| 217 | self.vi_mode = c["main"].as_bool("vi") |
| 218 | self.auto_expand = auto_vertical_output or c["main"].as_bool("auto_expand") |
| 219 | self.auto_retry_closed_connection = c["main"].as_bool("auto_retry_closed_connection") |
| 220 | self.expanded_output = c["main"].as_bool("expand") |
| 221 | self.pgspecial.timing_enabled = c["main"].as_bool("timing") |
| 222 | if row_limit is not None: |
| 223 | self.row_limit = row_limit |
| 224 | else: |
| 225 | self.row_limit = c["main"].as_int("row_limit") |
| 226 | |
| 227 | self.application_name = application_name |
| 228 | |
| 229 | # if not specified, set to DEFAULT_MAX_FIELD_WIDTH |
| 230 | # if specified but empty, set to None to disable truncation |
| 231 | # ellipsis will take at least 3 symbols, so this can't be less than 3 if specified and > 0 |
nothing calls this directly
no test coverage detected