diff --git a/changelog.md b/changelog.md index 367e62c8..e0f80593 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ Upcoming Bug Fixes: ---------- * Don't install tests. +* let the `--prompt` option act normally with its predefined default value 1.27.0 (2023/08/11) =================== diff --git a/mycli/AUTHORS b/mycli/AUTHORS index 133b8fc1..024a821c 100644 --- a/mycli/AUTHORS +++ b/mycli/AUTHORS @@ -96,6 +96,7 @@ Contributors: * Mel Dafert * Alfred Wingate * Zhanze Wang + * Houston Wong Created by: ----------- diff --git a/mycli/main.py b/mycli/main.py index 02a09cf9..264526df 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -93,6 +93,7 @@ class MyCli(object): default_prompt = '\\t \\u@\\h:\\d> ' + default_prompt_splitln = '\\u@\\h\\n(\\t):\\d>' max_len_prompt = 45 defaults_suffix = None @@ -643,7 +644,7 @@ def run_cli(self): def get_message(): prompt = self.get_prompt(self.prompt_format) if self.prompt_format == self.default_prompt and len(prompt) > self.max_len_prompt: - prompt = self.get_prompt('\\d> ') + prompt = self.get_prompt(self.default_prompt_splitln) prompt = prompt.replace("\\x1b", "\x1b") return ANSI(prompt) @@ -1150,7 +1151,7 @@ def get_last_query(self): help='list of DSN configured into the [alias_dsn] section of myclirc file.') @click.option('--list-ssh-config', 'list_ssh_config', is_flag=True, help='list ssh configurations in the ssh config (requires paramiko).') -@click.option('-R', '--prompt', 'prompt', +@click.option('-R', '--prompt', 'prompt', default=MyCli.default_prompt, help='Prompt format (Default: "{0}").'.format( MyCli.default_prompt)) @click.option('-l', '--logfile', type=click.File(mode='a', encoding='utf-8'),