cmdr

command line apps made easy

node-cmdr

command line router

Like dancer/sinatra/berliner, but for commandline interfaces:

require('cmdr')
  
  "say ([a-z]+) (\\d+) times?": (msg, times) ->
    for i in [0...times]
      console.log msg
  
  "buy something (cool|fancy) for \\w+": (adj, target) ->
    console.log "okay I'll find something #{adj} for #{target}"
    
  "help": (cmd) ->
    console.log "sorry, command #{cmd} is not recognized.\nValid commands are: ..."

Then use it:

$ myprogram say hello 4 times
hello
hello
hello
hello

Problem solved.

BSD (see LICENCE.txt for details)