nategood / commando

An Elegant CLI Library for PHP
MIT License
798 stars 80 forks source link

Implementation of repeatable options #39

Closed ghost closed 7 years ago

ghost commented 9 years ago

Hi,

I ended up implementing this for a project I'm working on. I called it magnitude, but could be renamed repeatable or something else. If there's any feedback, let me know and I can make edits.

The one "hack" is that options that have multiple letters that repeat are assumed to be "magnitude." I just didn't see any better way to do it.

Tests pass, but I have some more testing to do and see what happens.

Tested on PHP 5.4.30

ghost commented 9 years ago

Uggh, just realized I wasn't exactly finished... hold please.

ghost commented 9 years ago

Okay, that was an easy fix.

nategood commented 9 years ago

I like it. Thanks! I'll do a deeper review soon and get it merged in.

Potherca commented 9 years ago

Bump?

NeoVance commented 8 years ago

The one "hack" is that options that have multiple letters that repeat are assumed to be "magnitude." I just didn't see any better way to do it.

-1 the better way would be to implement it as a normal option rather than another option type, and treat each character in a SHORT_OPTION_TYPE as a different flag as I have done in #63.

nategood commented 7 years ago

Closing out in favor of #63