summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2024-03-24 15:59:59 -0700
committerGitHub <noreply@github.com>2024-03-24 15:59:59 -0700
commit048ee2668a12f366ab326539e1006e9da8006098 (patch)
tree14eeac0c23e746c8dd2b6f9c12d846b010b34d86
parent9bd237024e4f0e9a487bcd3c782bf044395f588c (diff)
parent7e04ccefa9bac526bc2871a9a7da152df6b67d12 (diff)
Merge pull request #1145 from hzc989/fix_default_prompt_20230115
fix(main.py): makes default prompt correctly
-rw-r--r--changelog.md1
-rw-r--r--mycli/AUTHORS1
-rwxr-xr-xmycli/main.py5
3 files changed, 5 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 367e62c..e0f8059 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 133b8fc..024a821 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 02a09cf..264526d 100755
--- a/mycli/main.py
+++ b/mycli/main.py
@@ -93,6 +93,7 @@ SUPPORT_INFO = (
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 @@ class MyCli(object):
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 @@ class MyCli(object):
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'),