Giter VIP home page Giter VIP logo

Comments (7)

NeoVance avatar NeoVance commented on September 16, 2024

I don't think there is an option type for that specific case. You can use the count option type multiple times, but it does not take a value.

You can use the map or cast option to achieve that though. Just pass in a function that will add the value to an array, and return the array of values.

from commando.

OnkelTem avatar OnkelTem commented on September 16, 2024

You can use the map or cast option to achieve that though. Just pass in a function that will add the value to an array, and return the array of values.

Could you please provide an example? Because I tried map (not cast though) and it was called only once...

from commando.

NeoVance avatar NeoVance commented on September 16, 2024

Wow. You are right. I totally missed that. I assumed it should work, but the tokens get deduped by array keys. Looks like it should be a fairly easy thing to fix though. I will look into putting up a PR soon.

from commando.

NeoVance avatar NeoVance commented on September 16, 2024

See PR #93 or my branch accumulator-for-multiple-options-of-same-name 47135e1489a0b765f8269f17599c9bed117dcd4a

from commando.

OnkelTem avatar OnkelTem commented on September 16, 2024

@NeoVance thanks man! I'll try it and write back

from commando.

NeoVance avatar NeoVance commented on September 16, 2024

Oh forgot to include the info.

reduce (Closure $reducer)

Aliases: list, each, every

Execute an accumulator/reducer function on every instance of the option in the command. Takes an accumulator function, and returns mixed (you can return any value). If you also supply a map for the option the map will execute on every value before it is passed to the accumulator function.

Signature: function(mixed $accumulated, mixed $value) : mixed

  • $accumulated: null|Option::default|mixed (the last value returned from the function, the option default value, or null.)
  • $value: mixed (the value that comes after the option. if map is supplied, the value returned from the map function.)
  • return: mixed (anything you want. The last value returned becomes the value of the Option after parsing.)

from commando.

nategood avatar nategood commented on September 16, 2024

Merged 93

from commando.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.