pertsevds

pertsevds

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?

Showing Posts 1 to 2

lud

lud

It does not seem normal, no.

With this version: Elixir 1.11.0 (compiled with Erlang/OTP 23)

and this script :

# ttt.exs

System.argv()
|> IO.inspect(label: "argv")

OptionParser.parse(System.argv(), strict: [options: :string])
|> IO.inspect(label: "parsed")

I get those results:

$ elixir ttt.exs --options=25,26
argv: ["--options=25,26"]
parsed: {[options: "25,26"], [], []}

But I am currently on MacOS. What if you run as elixir script.exs --options "25,26" ?

pertsevds

pertsevds OP

Experimented a little and found a source of the problem - PowerShell.

  1. 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”], , }

  1. 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”], }

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews