简体   繁体   English

如何编辑在Sudo(任何内容)命令上打印的字符串“ Password:key symbol”?

[英]How to edit the string “Password: key symbol ” printed on Sudo (anything) command?

I came here to ask for your help because I'm a little lost in this challenge I have in hands along some days. 我来这里是为了寻求您的帮助,因为几天来我面对的挑战让我有些失落。

My goal is simple (although I do not know if it's easy to implement on code) - edit/modify the string "Password: " printed on Sudo (anything) command which is usually accompanied by a key symbol on right. 我的目标很简单(尽管我不知道在代码上是否容易实现)-编辑/修改打印在Sudo(任何东西)命令上的字符串“ Password:”,该命令通常在右边带有一个键符号。 My goal is not only modify the sting for another one but also in case of that possibility, replace for another symbols. 我的目标不仅是修改另一个字符串的刺痛,而且在可能的情况下,替换另一个符号。 Looking on Mac OS or iTerm terminals we can see clearly examples of what I'm describing typing "sudo whoami". 在Mac OS或iTerm终端上查看,我们可以清楚地看到我所描述的键入“ sudo whoami”的示例。

Looking on Hyper Open Source terminal to accomplish my objective I don't understand why am I unnable to edit that string on node_modules/getpass/lib/index.js - line 46 (for who has this terminal installed). 查看Hyper Open Source终端以实现我的目标,我不明白为什么我无法在node_modules / getpass / lib / index.js-第46行(针对谁安装了此终端)上编辑该字符串。 It is the only file on this program where the word is supposed to be printed. 这是该程序上唯一应该打印该单词的文件。 After modifying the word/string, nothing changed. 修改单词/字符串后,没有任何变化。 Am I looking in the wrong place? 我看错地方了吗? Is it something more internal/deep to which I do not have access? 是我无法访问的更内部/更深入的东西吗?

I hope you can elucidate me on the way forward. 希望您能阐明我的前进方向。 Thanks for your time! 谢谢你的时间!

Are you trying to change it in Hyper itself? 您是否正在尝试在Hyper本身中进行更改?

You're referencing the module node-getpass , its getPass function looks like this: 您正在引用模块node-getpass ,其getPass函数如下所示:

.getPass([options, ]callback)

if you pass an object with a prompt property you can set a custom prompt, instead of the text Password. 如果您传递带有提示属性的对象,则可以设置自定义提示,而不是文本密码。

let options = {
    prompt: "Type your password:"
}

const pass = require('getpass')
pass.getPass(options, callback);

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

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