For example, if I wanted to automate authorizing a hex user. Something like
mix hex.user auth
#!/usr/bin/expect -f
expect "Username: "
send -- "$HEX_USERNAME\r"
expect "Password: "
send -- "$HEX_PASSWORD\r"
mix hex.user auth asks for Username: and Password: but I don't think expect works for this
Given the following script:
u = IO.gets("Username: ") |> String.strip
p = IO.gets("Password: ") |> String.strip
IO.puts ""
IO.puts "#{u} - #{p}"
You can pass input like this:
$ export HEX_USERNAME="hexuser"
$ export HEX_PASSWORD="hexpass"
$ echo "$HEX_USERNAME\n$HEX_PASSWORD" | elixir test.exs
Username: Password:
hexuser - hexpass
So, you could use
echo "$HEX_USERNAME\n$HEX_PASSWORD" | mix hex.user auth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With