pertsevds
Command line arguments parsing problem / How can i pass 2 arguments for an option?
script.exs source:
IO.inspect System.argv
running with:
elixir script.exs --options=25,26
Environment
-
Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 21 [erts-10.3] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Elixir 1.11.1 (compiled with Erlang/OTP 21) -
Operating system: Windows 10
Current behavior
Output:
[“–options”, “25”, “26”]
Expected behavior
Output:
[“–options”, “25,26”]
So, when i try to
OptionParser.parse(System.argv, strict: [options: :string])
it gives me only [options: “25”] and i want [options: “25,26”].
Is this a normal behavior?
Marked As Solved
pertsevds
Experimented a little and found a source of the problem - PowerShell.
- Through cmd.exe:
elixir ttt.exs --options 25,26
argv: [“–options”, “25”, “26”]
parsed: {[options: “25”], [“26”], }
but this works:
elixir ttt.exs --options “25,26”
argv: [“–options”, “25,26”]
parsed: {[options: “25,26”], , }
- Through PowerShell which is default on Win10:
elixir ttt.exs --options 25,26
argv: [“–options”, “25”, “26”]
parsed: {[options: “25”], [“26”], }
and this does not work either:
elixir ttt.exs --options “25,26”
argv: [“–options”, “25”, “26”]
parsed: {[options: “25”], [“26”], }







