简体   繁体   English

更改redis命令提示符文本

[英]change redis command prompt text

I have a free-tier Redis Enterprise instance on AWS. 我在AWS上有一个免费的Redis Enterprise实例。 I am running the latest stable version of redis on my Mac. 我正在Mac上运行Redis的最新稳定版本。 I can connect to my Redis Enterprise instance using redis-cli with the -h parameter, and I get an interactive session which allows me to create and retrieve keys. 我可以使用带有-h参数的redis-cli连接到Redis Enterprise实例,并且获得一个交互式会话,该会话允许我创建和检索密钥。 However, the command prompt shows the full host url, which takes up most of the width of default terminal window. 但是,命令提示符将显示完整的主机URL,该URL占用了默认终端窗口的大部分宽度。 Is there a way to change the command prompt text (like Export PS1="" in bash) in redis-cli? 有没有办法在redis-cli中更改命令提示符文本(例如bash中的Export PS1 =“”)? Is there a redis-cli command, or a config file I can change? 是否有redis-cli命令或我可以更改的配置文件?

Thanks, 谢谢,

Eric 埃里克

No. Regrettably there is no way to customize the prompt displayed by redis-cli. 不能。遗憾的是,无法自定义redis-cli显示的提示。

However, instead of using the long hostname, you can replace it with -h ip-address that is usually shorter. 但是,可以使用通常较短的-h ip-address代替长主机名,而不必使用长主机名。

Also, as a workaround, you could define the endpoint's hostname in your (where redis-cli is running) /etc/hosts as something shorter, eg: 另外,作为一种解决方法,您可以在您的(运行redis-cli的地方)/ etc / hosts中将端点的主机名定义为较短的名称,例如:

very.long.host.name.that.you.are.using    shorty

and then call the cli with it: 然后使用它调用cli:

redis-cli -h shorty

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM