This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task readPassword << { | |
// Get password from user input. | |
def console = System.console() | |
console.writer().write "\n" | |
def password = console.readPassword('%s: ', 'Please enter the password') | |
println password | |
} |
console.readPassword()で出力するメッセージが見やすくなるよう、直前で改行しています。なお、実際に使用する際は、取得したパスワードをprintlnしないようご注意ください(笑)。
素晴らしい記事、共有するためのありがとう!私がすることが、ここで、kata kata cinta のリンクを置くために許可を求めた?
返信削除