optparse-js icon indicating copy to clipboard operation
optparse-js copied to clipboard

Added ability to add callback inside the switch definition

Open perara opened this issue 10 years ago • 0 comments

Usage:

    switches = [
      ['-h', '--help', 'Show Help']
      ['-i', '--interval [INTERVAL]', 'Ping Interval', (key, val)->
        console.log "Interval is" + val
      ]
      ['-s', '--packetsize NUMBER', 'Packetsize', (key, val)->
        console.log "Packet Size is " + val
      ]
    ]

This removes some duplicate code.

perara avatar Apr 19 '15 08:04 perara