I realize CLI tooling isn't elixir's focus, but what I'd give for a nice argparser!

Something in-code like python's argparser would be phenomenal, which handles syntax and user experience for you. I think it wouldn't be hard, with macros:

```

defmodule MyParser do
  use ArgParser

  parser do
    command("d?hcp") do
      command("l?ist|ls") do
        option("--all|-a", :boolean, store: true)
        option("--mon?itor|-m", :boolean, store: true)
      end
    end

    command "g?enerate" do
      option("--f?orce|-f", :boolean, store: true)
      command("w?edge") do
         argument("slot", :integer, choices: [0, 1])
         option("--r?restart|-r", :boolean, store: true)
      end
    end
  end
```

Then just `MyParser.parse(args)`

I hear erlang's "argparse" is coming into OTP, but I haven't looked at it. I expect like most things erlang it's highly eldritch :D

I'll add it to the end of my todo list, just after ∞ unfortunately. But maybe I'll get to it.

Sidebar to this:

I know Elixir isn't focused on CLI, and there are few if any CLI things out there, but I'd contend it's a chicken-and-egg thing. There aren't CLI things out there because it's such a PITA to do it (having just wrestled with escript and others trying to do this I can assure you this is the case). I've seriously considered wrapping my elixir thing with a python script, just to make it more user-friendly and manageable. That's... well, it says something.

-Brandon

--
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/d969eddb-c7bf-8cf8-99ee-c4fa16a5f52e%40cold.org.

Reply via email to