angular-cli/packages/@angular/cli/ember-cli/lib/utilities/merge-blueprint-options.js
Hans 601f9b38f8 feat(@angular/cli): move angular-cli to @angular/cli (#4328)
This release is otherwise identical to beta.28.
2017-02-01 18:19:50 -08:00

32 lines
852 B
JavaScript

'use strict';
var SilentError = require('silent-error');
var Blueprint = require('../models/blueprint');
/*
* Helper for commands that use a blueprint to merge the blueprint's options
* into the command's options so they can be passed in. Needs to be invoked
* with `this` pointing to the command object, e.g.
*
* var mergeBlueprintOptions = require('../utilities/merge-blueprint-options');
*
* Command.extend({
* beforeRun: mergeBlueprintOptions
* })
*/
module.exports = function(rawArgs) {
if (rawArgs.length === 0) {
return;
}
// merge in blueprint availableOptions
var blueprint;
try {
blueprint = Blueprint.lookup(rawArgs[0], {
paths: this.project.blueprintLookupPaths()
});
this.registerOptions(blueprint);
} catch (e) {
SilentError.debugOrThrow('ember-cli/commands/' + this.name, e);
}
};