lib/qx/tool/cli/commands/MConfig.js
function(parsedArgs, config, contribConfig) {
      if (parsedArgs.config) {
        var defaultTarget = parsedArgs.target||config.defaultTarget;
        if (defaultTarget) {
          for (var i = 0; i < config.targets.length; i++) {
            if (config.targets[i].type === defaultTarget) {
              config.target = config.targets[i];
              break;
            }
          }
        }
        if (!config.target) {
          if (config.targets && (config.targets.length > 0)) {
            config.target = config.targets[0];
          }
        }
      } else {
        var target = config.target = {};
        if (parsedArgs.target) {
          target.type = parsedArgs.target;
        }
        if (parsedArgs.outputPath) {
          target.outputPath = parsedArgs.outputPath;
        }
      }

      if (!config.locales) {
        config.locales = [];
      }
      if (parsedArgs.locales) {
        parsedArgs.locales.forEach(function(locale) {
          if (config.locales.indexOf(locale) < 0) {
            config.locales.push(locale);
          }
        });
      }
      if (typeof parsedArgs.writeAllTranslations == "boolean") {
        config.writeAllTranslations = parsedArgs.writeAllTranslations;
      }

      if (parsedArgs.environment) {
        if (!config.environment) {
          config.environment = {};
        }
        /* eslint-disable guard-for-in */
        for (var key in parsedArgs.environment) {
          config.environment[key] = parsedArgs.environment[key];
        }
        /* eslint-enable guard-for-in */
      }

      if (!config.applications) {
        config.applications = [];
      }
      parsedArgs.applications.forEach(function(app) {
        if (!app.appClass) {
          throw new Error("Missing --app-class <classname> argument");
        }
        var configApp = {
          class: app.appClass
        };
        if (app.theme) {
          configApp.theme = app.theme;
        }
        if (app.name) {
          configApp.name = app.name;
        }
        config.applications.push(configApp);
      });

      if (parsedArgs.libraries) {
        if (!config.libraries) {
          config.libraries = [];
        }
        parsedArgs.libraries.forEach(function(aPath) {
          config.libraries.push(aPath);
        });
      }

      // Add default library for this project
      if (!config.libraries.length) {
        config.libraries.push(".");
      }

      if (contribConfig.libraries) {
        config.contribs = {};
        contribConfig.libraries.forEach(function(library) {
          config.libraries.push(library.path);
          config.contribs[library.uri] = library.path;
        });
      }

      if (!config.serve) {
        config.serve = {};
      }
      if (this.isExplicitArg("listen-port")) {
        config.serve.listenPort = this.argv.listenPort;
      } else {
        config.serve.listenPort = config.serve.listenPort || this.argv.listenPort;
      }
    }
function(parsedArgs, config, contribConfig) {
      if (parsedArgs.config) {
        var defaultTarget = parsedArgs.target||config.defaultTarget;
        if (defaultTarget) {
          for (var i = 0; i < config.targets.length; i++) {
            if (config.targets[i].type === defaultTarget) {
              config.target = config.targets[i];
              break;
            }
          }
        }
        if (!config.target) {
          if (config.targets && (config.targets.length > 0)) {
            config.target = config.targets[0];
          }
        }
      } else {
        var target = config.target = {};
        if (parsedArgs.target) {
          target.type = parsedArgs.target;
        }
        if (parsedArgs.outputPath) {
          target.outputPath = parsedArgs.outputPath;
        }
      }

      if (!config.locales) {
        config.locales = [];
      }
      if (parsedArgs.locales) {
        parsedArgs.locales.forEach(function(locale) {
          if (config.locales.indexOf(locale) < 0) {
            config.locales.push(locale);
          }
        });
      }
      if (typeof parsedArgs.writeAllTranslations == "boolean") {
        config.writeAllTranslations = parsedArgs.writeAllTranslations;
      }

      if (parsedArgs.environment) {
        if (!config.environment) {
          config.environment = {};
        }
        /* eslint-disable guard-for-in */
        for (var key in parsedArgs.environment) {
          config.environment[key] = parsedArgs.environment[key];
        }
        /* eslint-enable guard-for-in */
      }

      if (!config.applications) {
        config.applications = [];
      }
      parsedArgs.applications.forEach(function(app) {
        if (!app.appClass) {
          throw new Error("Missing --app-class <classname> argument");
        }
        var configApp = {
          class: app.appClass
        };
        if (app.theme) {
          configApp.theme = app.theme;
        }
        if (app.name) {
          configApp.name = app.name;
        }
        config.applications.push(configApp);
      });

      if (parsedArgs.libraries) {
        if (!config.libraries) {
          config.libraries = [];
        }
        parsedArgs.libraries.forEach(function(aPath) {
          config.libraries.push(aPath);
        });
      }

      // Add default library for this project
      if (!config.libraries.length) {
        config.libraries.push(".");
      }

      if (contribConfig.libraries) {
        config.contribs = {};
        contribConfig.libraries.forEach(function(library) {
          config.libraries.push(library.path);
          config.contribs[library.uri] = library.path;
        });
      }

      if (!config.serve) {
        config.serve = {};
      }
      if (this.isExplicitArg("listen-port")) {
        config.serve.listenPort = this.argv.listenPort;
      } else {
        config.serve.listenPort = config.serve.listenPort || this.argv.listenPort;
      }
    }
function ( parsedArgs , config , contribConfig ) { if ( parsedArgs . config ) { var defaultTarget = parsedArgs . target || config . defaultTarget ; if ( defaultTarget ) { for ( var i = 0 ; i < config . targets . length ; i ++ ) { if ( config . targets [ i ] . type === defaultTarget ) { config . target = config . targets [ i ] ; break ; } } } if ( ! config . target ) { if ( config . targets && ( config . targets . length > 0 ) ) { config . target = config . targets [ 0 ] ; } } } else { var target = config . target = { } ; if ( parsedArgs . target ) { target . type = parsedArgs . target ; } if ( parsedArgs . outputPath ) { target . outputPath = parsedArgs . outputPath ; } } if ( ! config . locales ) { config . locales = [ ] ; } if ( parsedArgs . locales ) { parsedArgs . locales . forEach ( function ( locale ) { if ( config . locales . indexOf ( locale ) < 0 ) { config . locales . push ( locale ) ; } } ) ; } if ( typeof parsedArgs . writeAllTranslations == "boolean" ) { config . writeAllTranslations = parsedArgs . writeAllTranslations ; } if ( parsedArgs . environment ) { if ( ! config . environment ) { config . environment = { } ; } /* eslint-disable guard-for-in */ for ( var key in parsedArgs . environment ) { config . environment [ key ] = parsedArgs . environment [ key ] ; } /* eslint-enable guard-for-in */ } if ( ! config . applications ) { config . applications = [ ] ; } parsedArgs . applications . forEach ( function ( app ) { if ( ! app . appClass ) { throw new Error ( "Missing --app-class <classname> argument" ) ; } var configApp = { class : app . appClass } ; if ( app . theme ) { configApp . theme = app . theme ; } if ( app . name ) { configApp . name = app . name ; } config . applications . push ( configApp ) ; } ) ; if ( parsedArgs . libraries ) { if ( ! config . libraries ) { config . libraries = [ ] ; } parsedArgs . libraries . forEach ( function ( aPath ) { config . libraries . push ( aPath ) ; } ) ; } // Add default library for this project if ( ! config . libraries . length ) { config . libraries . push ( "." ) ; } if ( contribConfig . libraries ) { config . contribs = { } ; contribConfig . libraries . forEach ( function ( library ) { config . libraries . push ( library . path ) ; config . contribs [ library . uri ] = library . path ; } ) ; } if ( ! config . serve ) { config . serve = { } ; } if ( this . isExplicitArg ( "listen-port" ) ) { config . serve . listenPort = this . argv . listenPort ; } else { config . serve . listenPort = config . serve . listenPort || this . argv . listenPort ; } }
/*
Merges the argv into the config data
/ * Merges the argv into the config data