Add cf app command *
330405
function describeAppVerbose(app) {
		var name = app.name;
		var strResult = "\n" + name + ": ";
		var runningInstances = app.running_instances;
		var instances = app.instances;
		if (!runningInstances) {
			runningInstances = 0;
		}
		var percentage = runningInstances / instances * 100;
		strResult += percentage + "%";
		strResult += "\n\t" + messages["usage:"] + app.memory + "M x ";
		strResult += i18Util.formatMessage(messages["${0}Instance(s)"], runningInstances);
		strResult += "\n\t" + messages["url:"];
		
		if (app.routes && app.routes.length > 0){
			var host = app.routes[0].host;
			var domain = app.routes[0].domain.name;
			var route = host + "." + domain;
			strResult += "[" + route + "](http://" + route + ")";
		}
		
		return strResult;
	}
319920
def setup_app(command, conf, vars):
    """"""
    load_environment(conf.global_conf, conf.local_conf)
    setup_schema(command, conf, vars)
    bootstrap.bootstrap(command, conf, vars)
1357880
protected void addCommand(String label, String help, Command cmd, boolean needsAuth) {
        commands.put(label.toUpperCase(), new CommandInfo(cmd, help, needsAuth));
    }
1273190
def add_command_alias(command_name, alias_command, callback) #:nodoc:
      original_command = @commands[:meta][command_name]
      original_command[:syntax] << alias_command[:syntax]

      alias_name = command_name(alias_command[:syntax])

      alias_command[:is_public] = original_command[:is_public]

      add_command_meta(alias_name, original_command, true)
      add_command_spec(alias_command, callback)
    end
1330495
def fstab_add(dev, mp, fs, options=None):
    """"""
    return Fstab.add(dev, mp, fs, options=options)
571727
def add_command(self, cmd, name=None):
        
        name = name or cmd.name
        if name is None:
            raise TypeError('Command has no name.')
        _check_multicommand(self, name, cmd, register=True)
        self.commands[name] = cmd
106651
def cp_cmd(argv):
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument('source')
    parser.add_argument('target', nargs='?')
    parser.add_argument('-d', '--dont-activate', action='store_false',
                        default=True, dest='activate', help="After \
                        creation, continue with the existing shell (don't \
                        activate the new environment).")

    args = parser.parse_args(argv)
    target_name = copy_virtualenv_project(args.source, args.target)
    if args.activate:
        shell(target_name)
1223392
def _add(self, name, *args, **kwargs):
        ''''''

        self.commands.append(Command(name, args, kwargs))
834634
def _setup_install_commands_from_kwargs(kwargs, keys=tuple()):
        """"""
        cmd_list = []
        if kwargs.get('override_channels', False) and 'channel' not in kwargs:
            raise TypeError('conda search: override_channels requires channel')

        if 'env' in kwargs:
            cmd_list.extend(['--name', kwargs.pop('env')])
        if 'prefix' in kwargs:
            cmd_list.extend(['--prefix', kwargs.pop('prefix')])
        if 'channel' in kwargs:
            channel = kwargs.pop('channel')
            if isinstance(channel, str):
                cmd_list.extend(['--channel', channel])
            else:
                cmd_list.append('--channel')
                cmd_list.extend(channel)

        for key in keys:
            if key in kwargs and kwargs[key]:
                cmd_list.append('--' + key.replace('_', '-'))

        return cmd_list
960820
function addCommands(commands){
	for(var i in commands){
		var commandObj = commands[i];
		addCommand(commandObj);
	}

	return module.exports;
}
654935
def vcs_command(self, fnames, action):
        """"""
        try:
            for path in sorted(fnames):
                vcs.run_vcs_tool(path, action)
        except vcs.ActionToolNotFound as error:
            msg = _("For %s support, please install one of the<br/> "
                    "following tools:<br/><br/>  %s")\
                        % (error.vcsname, ', '.join(error.tools))
            QMessageBox.critical(self, _("Error"),
                _("""<b>Unable to find external program.</b><br><br>%s""")
                    % to_text_string(msg))
554926
protected function bootCommand()
    {
        foreach ($this->commands as $command) {
            $this->add($this->app->make($command));
        }
    }
493521
def add_command(self, command):
        
        self._commands.append(command)
        self._build_command_chain(command)
1086771
def setup_app(command, conf, vars):
    """"""
    load_environment(conf.global_conf, conf.local_conf)

    # Merge and minify JavaScript code
    input_file = config['js_tmpl']
    public_dir = config['pylons.paths']['static_files']
    output_file = os.path.join(public_dir, 'js', 'Studio', 'studio-all.js')
    _merge_js(input_file, public_dir, output_file)
    log.info('JavaScript successfully merged and minified in ' + output_file)

    # Load the models
    from studio.model import meta
    meta.metadata.bind = meta.engine

    filename = os.path.split(conf.filename)[-1]
    if filename == 'test.ini':
        # Permanently drop any existing tables
        log.info("Dropping existing tables...")
        meta.metadata.drop_all(checkfirst=True)

    # Create the tables if they aren't there already
    meta.metadata.create_all(checkfirst=True)

    # Create permissions
    # datastores permissions
    perm_create_update_datastores = model.Permission()
    perm_create_update_datastores.name = 'create_update_datastores'
    meta.Session.add(perm_create_update_datastores)
    perm_view_datastores = model.Permission()
    perm_view_datastores.name = 'view_datastores'
    meta.Session.add(perm_view_datastores)
    # datasources permissions
    perm_view_datasources = model.Permission()
    perm_view_datasources.name = 'view_datasources'
    meta.Session.add(perm_view_datasources)
    perm_create_datasources = model.Permission()
    perm_create_datasources.name = 'create_datasources'
    meta.Session.add(perm_create_datasources)
    # mapfiles permissions
    perm_create_update_mapfiles = model.Permission()
    perm_create_update_mapfiles.name = 'create_update_mapfiles'
    meta.Session.add(perm_create_update_mapfiles)
    perm_view_mapfiles = model.Permission()
    perm_view_mapfiles.name = 'view_mapfiles'
    meta.Session.add(perm_view_mapfiles)
    # layertemplates permissions
    perm_create_update_layertemplates = model.Permission()
    perm_create_update_layertemplates.name = 'create_update_layertemplates'
    meta.Session.add(perm_create_update_layertemplates)
    perm_view_layertemplates = model.Permission()
    perm_view_layertemplates.name = 'view_layertemplates'
    meta.Session.add(perm_view_layertemplates)

    # Create group admin
    admin_gp = model.Group()
    admin_gp.name = 'admin'
    admin_gp.permissions.append(perm_create_update_datastores)
    admin_gp.permissions.append(perm_view_datastores)
    admin_gp.permissions.append(perm_view_datasources)
    admin_gp.permissions.append(perm_create_datasources)
    admin_gp.permissions.append(perm_create_update_mapfiles)
    admin_gp.permissions.append(perm_view_mapfiles)
    admin_gp.permissions.append(perm_create_update_layertemplates)
    admin_gp.permissions.append(perm_view_layertemplates)
    meta.Session.add(admin_gp)

    # Create group enduser
    enduser_gp = model.Group()
    enduser_gp.name = 'enduser'
    enduser_gp.permissions.append(perm_view_datastores)
    enduser_gp.permissions.append(perm_view_datasources)
    enduser_gp.permissions.append(perm_create_update_mapfiles)
    enduser_gp.permissions.append(perm_view_mapfiles)
    enduser_gp.permissions.append(perm_create_update_layertemplates)
    enduser_gp.permissions.append(perm_view_layertemplates)
    meta.Session.add(enduser_gp)

    # Create user admin
    admin = model.User()
    admin.name = 'Admin'
    admin.login = 'admin'
    admin.password = config['admin_password']
    admin.groups.append(admin_gp)
    meta.Session.add(admin)

    if filename == 'test.ini':
        # create enduser user for test purpose only
        enduser = model.User()
        enduser.name = 'Test User'
        enduser.login = 'enduser'
        enduser.password = 'password'
        enduser.groups.append(enduser_gp)
        meta.Session.add(enduser)

    mfdir = config['mapfiles_dir']
    if not os.path.exists(mfdir):
        os.makedirs(mfdir, 0755)

    if 'default_datastore_postgis' in config:
        # Create default datastore
        datastore = model.DataStore('default (postgis)', 'postgis', config['default_datastore_postgis'])
        meta.Session.add(datastore)
        meta.Session.flush()

    if 'default_datastore_dir' in config:
        # Create default datastore
        datastore = model.DataStore('default (directory)', 'directory', config['default_datastore_dir'])
        meta.Session.add(datastore)
        meta.Session.flush()

        # Create dummy mapfile
        mapfile = create_default_mapfile()
        dict = mapfile.to_dict()
        ds = DataStore(datastore.ogrstring)
        dsources = ds.get_datasources()
        palette = QualitativePalette(len(dsources)).get_palette()
        for dss in dsources:
            if dss.type == 'RASTER':
                print "adding %s datasource"%dss.name
                l = _make_mapfile_layer(datastore.id,dss)
                if 'projection' in l:
                    dict['projection'] = l['projection']
                dict['layers'].append(l)
        for dss in dsources:
            if dss.type == 'POLYGON':
                print "adding %s datasource"%dss.name
                color = palette.pop(0)
                l = _make_mapfile_layer(datastore.id,dss)
                if 'projection' in l:
                    dict['projection'] = l['projection']
                l['classes'][0]['styles'][0]['color']=color
                dict['layers'].append(l)
        for dss in dsources:
            if dss.type == 'LINE':
                print "adding %s datasource"%dss.name
                color = palette.pop(0)
                l = _make_mapfile_layer(datastore.id,dss)
                if 'projection' in l:
                    dict['projection'] = l['projection']
                l['classes'][0]['styles'][0]['color']=color
                dict['layers'].append(l)
        for dss in dsources:
            if dss.type == 'POINT':
                print "adding %s datasource"%dss.name
                color = palette.pop(0)
                l = _make_mapfile_layer(datastore.id,dss)
                if 'projection' in l:
                    dict['projection'] = l['projection']
                l['classes'][0]['styles'][0]['color']=color
                dict['layers'].append(l)
        if 'projection' not in dict:
            dict['projection']="init=epsg:4326"
        mapfile.from_dict(dict)
        mapfile.to_file(os.path.join(config['mapfiles_dir'], 'dummy_mapfile.map'))

        # Create dummy_mapfile in db, owned by user 'admin'
        map = model.Map('dummy_mapfile', 'dummy_mapfile.map', 1)
        model.meta.Session.add(map)

    # Commit the new objects into the database
    meta.Session.commit()

    log.info("Data successfully set up")
766578
def add_command(self, command, *args, **kwargs):
        
        cmd = self.add_parser(command, *args, **kwargs)
1371329
def get_add_files_command(self, *filenames):
        """"""
        command = ['git', 'add']
        if filenames:
            command.append('--')
            command.extend(filenames)
        else:
            command.extend(('--all', '.'))
        return command
1292333
def cmd_xcode(self, *args):
        '''
        '''
        app_name = self.buildozer.namify(self.buildozer.config.get('app',
            'package.name'))
        app_name = app_name.lower()

        ios_dir = ios_dir = join(self.buildozer.platform_dir, 'kivy-ios')
        self.buildozer.cmd('open {}.xcodeproj'.format(
            app_name), cwd=join(ios_dir, '{}-ios'.format(app_name)))