@@ -17,13 +17,14 @@ defmodule Loki.Shell do
17
17
Ask user input with given message. Returns tuple with parsed options.
18
18
"""
19
19
@ spec ask ( String . t ) :: { List . t , List . t , List . t }
20
- def ask ( message ) when is_input ( message ) do
21
- args = format ( IO . gets message )
20
+ def ask ( message , opts \\ [ ] )
21
+ def ask ( message , opts ) when is_input ( message ) do
22
+ args = format ( IO . gets ( message ) , opts )
22
23
OptionParser . parse ( [ args ] )
23
24
end
24
25
25
- @ spec ask ( any ) :: none ( )
26
- def ask ( _any ) , do: raise ArgumentError , message: "Invalid argument, accept String or List!"
26
+ @ spec ask ( any , any ) :: none ( )
27
+ def ask ( _message , _ops ) , do: raise ArgumentError , message: "Invalid argument, accept String or List!"
27
28
28
29
29
30
@ doc """
@@ -219,6 +220,8 @@ defmodule Loki.Shell do
219
220
220
221
221
222
@ spec format ( String . t ) :: String . t
222
- defp format ( input ) , do: String . replace ( input , "\n " , "" ) |> String . downcase
223
+ defp format ( input , opts \\ [ ] )
224
+ defp format ( input , [ sensitive: true ] ) , do: String . replace ( input , "\n " , "" )
225
+ defp format ( input , _opts ) , do: String . replace ( input , "\n " , "" ) |> String . downcase
223
226
end
224
227
0 commit comments