The reason only single letters are allowed is to support the sort of
shortcut that's common on Unix command lines. For example, if you have two
aliases named -f and -a, you can pass them as -fa. I believe we could still
support multi letter aliases but probably not worth the added complexity.
If you really need multi letter aliases, you can always do a prepass on the
args and expand them.



*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

On Fri, Dec 23, 2016 at 3:11 AM, Chris Keele <[email protected]> wrote:

> Currently only single-letter aliases are allowed. Is this intentional or
> would the capacity to alias, for instance, option "foo" as "bar" be a
> welcome PR?
>
> On Sunday, February 21, 2016 at 4:27:20 AM UTC-8, José Valim wrote:
>>
>> Yes, improvements to the action parser will be really welcome. Feel free
>> to expand on your proposals here and send PRs. For example, :count could be
>> done in the existing :switches configuration. I would also be ok with
>> support -vn and the like.
>>
>>
>>
>> *José Valim*
>> www.plataformatec.com.br
>> Skype: jv.ptec
>> Founder and Director of R&D
>>
>> On Sun, Feb 21, 2016 at 1:14 PM, derek <[email protected]> wrote:
>>
>>> Hi, I'm a new in Erlang/Elixir with somewhat good Python background,
>>> trying to write some small shell utils in Elixir exs script and am
>>> surprised the OptionParser is limited and totally missing in Erlang
>>> standard lib, I read somewhat rebar code and it's using the
>>> `jcomellas/getopt` [3] solution, but I prefer a in lib solution,
>>>
>>> Problems with current Elixir OptionParser:
>>> 1. it doesn't support combine switches, like "-vn" should be treated
>>> same as "-v -n" if both are not requiring an argument;
>>> 2. I need to count behaviour like the Python argparser
>>> `action="count"`; it will be useful to support "--verbose" or "-vvv"
>>> to mean increased verbosity
>>>
>>> parser.add_argument("-v", "--verbosity", action="count",
>>>                     help="increase output verbosity")
>>>
>>>
>>> [1] http://elixir-lang.org/docs/master/elixir/OptionParser.html
>>> [2] https://github.com/elixir-lang/elixir/blob/master/lib/elixir
>>> /lib/option_parser.ex
>>> [3] https://github.com/jcomellas/getopt
>>> [4] https://docs.python.org/2/howto/argparse.html
>>>
>>> I'm trying to improve OptionParser, have some local changes in
>>> option_parser.ex, basically I hope it can be as powerful as Python
>>> argparse module [4]; would like to see here if you have some more
>>> ideas,
>>>
>>>
>>> Thanks,
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/elixir-lang-core/CAJctwx4P4260r0WiMD7pDScReiqwc5vg88MufV
>>> Hm9hyV6mpvRA%40mail.gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/0363554a-3df7-4e8a-bf5a-
> 82a044321142%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/0363554a-3df7-4e8a-bf5a-82a044321142%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Kf9i-e-iDA1K1G-1wDy%2BnBsNzG-2%3DUiNGxGeW55yfweA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to