adhocore / php-cli

PHP Console Application made easy- build great console apps with ease. Comes with Zero Dependency and Autocompletion support. Think of it as a PHP cli application framework.
https://github.com/adhocore/php-cli
MIT License
334 stars 35 forks source link

New features and some fixes - Variadic arguments flexibility and grouping, Negative numbers #94

Closed shlomohass closed 9 months ago

shlomohass commented 11 months ago

This is the result of / and fixes #93

What has changed:

Introduced a new Tokenizer class to enable a more advanced syntax to be parsed (Normalizer now only handles the value filtering)

# Now, variadic arguments can be explicitly used : 
$ app cmd arg11 arg12 --opt [ val1 val2 ] # 👍 
$ app cmd [arg11 arg12] --opt [val1 val2] # 👍 
$ app cmd arg11 arg12 --opt val1 val2 # 👍 
$ app cmd [arg11 arg12] [arg21 arg22] --opt val1 val2 # 👍 
$ app cmd arg1 arg2 --flags [ -- -a -b -c ] --opt val1 val2 # amazingly this one is working also 👍 

#Negative numbers:
$ app scan --offset -5 # 👍 

Tested on/with:

Notes:

I have some more ideas for future improvements 😄

adhocore commented 11 months ago

oh, just saw this and looks great. i will check indepth from PC soon. thanks for working out the PR

shlomohass commented 11 months ago

@adhocore Take your time and test it carefully. I really did my best to cover any weird (sensible) combination, but you can never be sure.

shlomohass commented 11 months ago

@adhocore Sure I'll start making the edits. I thought the CodeFactor has autofix for all the empty lines and so on... I will do it on my branch and update the pull.

shlomohass commented 11 months ago

image

Those Are the inputs: image

On:

I'm sure it can be improved even more...