pfraces-graveyard / clide

CLI definitions
0 stars 0 forks source link

requireJS-like API #4

Closed pfraces closed 10 years ago

pfraces commented 10 years ago
clide({
    user: 'User name',
    pass: {
        description: 'Password',
        hidden: true
    }
}, function (user, pass, options) {
    // ...
});
pfraces commented 10 years ago

CommonJS is better than RequireJS syntax because modifications are done in one place.

This can be fixed here passing just the options object:

clide({
    user: 'User name',
    pass: {
        description: 'Password',
        hidden: true
    }
}, function (options) {
    console.log(options.pass); // Ooops!
});
pfraces commented 10 years ago

The first syntax has a bug: the object passed is not an array so its properties are not ordered.

That makes impossible to assure the correct order in the function arguments.

This can be fixed with what the previous comment propossed

pfraces commented 10 years ago

73aaf61