flatiron/director — Issue #83: CLI routing bug
Author: phzbox
Created: 2012-02-27 09:34:22+00:00
State: open

> cat test.js

var director = require('director');

var router = new director.cli.Router({
'create': function() { console.log('create'); }
});

router.dispatch('on', process.argv.slice(2).join(' '));

>> node test.js create
>> node test.js eate
create
-------------------------------------------------

Basically, the bugs seem to be in router.js in the mount/insertOrMount function.
....
isRoute = parts[0] === "" || !self._methods[parts[0]]
....
if (isRoute) {
rename = rename.slice(self.delimiter.length);
parts.shift();
}
// Here, rename is 'eate' as self.delimter is '\s'

Hope it helps