update.js 920 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. var Project = require('../core/Project');
  2. var cli = require('../util/cli');
  3. var defaultConfig = require('../config');
  4. function update(logger, names, options, config) {
  5. var project;
  6. options = options || {};
  7. config = defaultConfig(config);
  8. project = new Project(config, logger);
  9. // If names is an empty array, null them
  10. if (names && !names.length) {
  11. names = null;
  12. }
  13. return project.update(names, options);
  14. }
  15. // -------------------
  16. update.line = function (logger, argv) {
  17. var options = update.options(argv);
  18. var names = options.argv.remain.slice(1);
  19. return update(logger, names, options);
  20. };
  21. update.options = function (argv) {
  22. return cli.readOptions({
  23. 'force-latest': { type: Boolean, shorthand: 'F' },
  24. 'production': { type: Boolean, shorthand: 'p' }
  25. }, argv);
  26. };
  27. update.completion = function () {
  28. // TODO:
  29. };
  30. module.exports = update;