Unfortunately :io.get_password works only in limited scenarios, so I don't
think we should provide first class conveniences around it until this
limitation is addressed in Erlang/OTP:

$ elixir -e "IO.inspect :io.get_password"
{:error, {:request, {:get_password, :unicode}}}

On Mon, Nov 8, 2021 at 10:51 PM Darragh Enright <darraghenri...@gmail.com>
wrote:

> For the sake of accuracy, I probably should correct the above code snippet
> to something like:
>
> def password(message) do
> print_app()
> IO.puts(message <> " ")
> List.to_string(:io.get_password())
> end
>
>
> On Monday, 8 November 2021 at 18:51:25 UTC Darragh Enright wrote:
>
>> Hello folks 👋
>>
>> I was making a tweak to Mix.Shell.IO.yes?/1 a while back and it occurred
>> to me that it would also nice to have a password function, much the same as
>> Mix.Shell.IO.prompt/1 except it would hide input from the user, which I
>> am sure is familiar functionality to almost every developer.
>>
>> I just had some time to look into how to implement this and it seems this
>> would be easy to implement by wrapping :io.get_password/1 — for example:
>>
>> def password(message) do
>> print_app()
>> :io.get_password(message <> " ")
>> end
>>
>> Of course, in saying that, would that be a counterargument for precluding
>> creating this functionality at all? :D
>>
>> Thanks!
>> Darragh
>>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/16a21fa4-0984-445a-be62-581bfce0f32cn%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/16a21fa4-0984-445a-be62-581bfce0f32cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KRWQdvkegQEfP0pDCW3AZPkja8DsNb4CtVoUODhm7SGQ%40mail.gmail.com.

Reply via email to