Configure dirs from env, composer extra values, and via user input.
4920
private function configureDirs()
    {
        // Configure dirs from environment variables and composer extra values.
        foreach ($this->resolver->names() as $name) {
            $default = $this->resolver->raw($name);
            $path = $this->options->get($name . '-dir', $default);
            if ($path !== $default) {
                $this->verbose("Setting <info>$name</> path to <info>$path</>.");
                $this->resolver->define($name, $path);
            }
        }

        if ($this->io->confirm("Do you want to use Bolt's standard folder structure?")) {
            return;
        }

        (new PathCustomizer($this->resolver, $this->io))->run();

        $this->io->writeln("\n<info>Customizing!</info>\n");
    }
260760
protected function configure()
    {
        $bits = explode('\\', get_class($this));

        $this->setName($this->getCommandNamePrefix() . Inflector::tableize(array_pop($bits)))
            ->addOption('debug', '', InputOption::VALUE_NONE, 'Output debug details')
            ->addOption('json', '', InputOption::VALUE_NONE, 'Output JSON')
            ->addOption('environment', 'e', InputOption::VALUE_REQUIRED, 'Environment in which we are are running (development, staging or production)', 'development');
    }
1072721
def presets_dir():
    """"""
    default_presets_dir = os.path.join(
        os.path.expanduser("~"), ".be", "presets")
    presets_dir = os.environ.get(BE_PRESETSDIR) or default_presets_dir
    if not os.path.exists(presets_dir):
        os.makedirs(presets_dir)
    return presets_dir
995736
protected function set_env()
    {
        if ($this->delimiter !== null && $this->namespace !== null) {
            return;
        }

        $config         = rcube::get_instance()->config;
        $imap_personal  = $config->get('imap_ns_personal');
        $imap_other     = $config->get('imap_ns_other');
        $imap_shared    = $config->get('imap_ns_shared');
        $imap_delimiter = $config->get('imap_delimiter');

        if (!$this->check_connection()) {
            return;
        }

        $ns = $this->conn->getNamespace();

        // Set namespaces (NAMESPACE supported)
        if (is_array($ns)) {
            $this->namespace = $ns;
        }
        else {
            $this->namespace = array(
                'personal' => NULL,
                'other'    => NULL,
                'shared'   => NULL,
            );
        }

        if ($imap_delimiter) {
            $this->delimiter = $imap_delimiter;
        }
        if (empty($this->delimiter)) {
            $this->delimiter = $this->namespace['personal'][0][1];
        }
        if (empty($this->delimiter)) {
            $this->delimiter = $this->conn->getHierarchyDelimiter();
        }
        if (empty($this->delimiter)) {
            $this->delimiter = '/';
        }

        // Overwrite namespaces
        if ($imap_personal !== null) {
            $this->namespace['personal'] = NULL;
            foreach ((array)$imap_personal as $dir) {
                $this->namespace['personal'][] = array($dir, $this->delimiter);
            }
        }
        if ($imap_other !== null) {
            $this->namespace['other'] = NULL;
            foreach ((array)$imap_other as $dir) {
                if ($dir) {
                    $this->namespace['other'][] = array($dir, $this->delimiter);
                }
            }
        }
        if ($imap_shared !== null) {
            $this->namespace['shared'] = NULL;
            foreach ((array)$imap_shared as $dir) {
                if ($dir) {
                    $this->namespace['shared'][] = array($dir, $this->delimiter);
                }
            }
        }

        // Find personal namespace prefix(es) for self::mod_folder()
        if (is_array($this->namespace['personal']) && !empty($this->namespace['personal'])) {
            // There can be more than one namespace root,
            // - for prefix_out get the first one but only
            //   if there is only one root
            // - for prefix_in get the first one but only
            //   if there is no non-prefixed namespace root (#5403)
            $roots = array();
            foreach ($this->namespace['personal'] as $ns) {
                $roots[] = $ns[0];
            }

            if (!in_array('', $roots)) {
                $this->namespace['prefix_in'] = $roots[0];
            }
            if (count($roots) == 1) {
                $this->namespace['prefix_out'] = $roots[0];
            }
        }

        $_SESSION['imap_namespace'] = $this->namespace;
        $_SESSION['imap_delimiter'] = $this->delimiter;
    }
158126
protected function configure()
    {
        $this->basePath = getcwd();
        $this->projectName = basename($this->basePath);
        $this->defaultName = $this->slug($this->projectName);

        $this
            ->setName('make')
            ->setDescription('Install Artestead into the current project')
            ->addOption('type', null, InputOption::VALUE_REQUIRED, 'Type of hosting: drupal, laravel, symfony, wordpress') // New
            ->addOption('name', null, InputOption::VALUE_OPTIONAL, 'The name of the virtual machine.', $this->defaultName)
            ->addOption('hostname', null, InputOption::VALUE_OPTIONAL, 'The hostname of the virtual machine.', str_replace('.local.local', '.local', "www.{$this->projectName}.local"))
            ->addOption('ip', null, InputOption::VALUE_OPTIONAL, 'The IP address of the virtual machine.')
            ->addOption('after', null, InputOption::VALUE_NONE, 'Determines if the after.sh file is created.')
            ->addOption('aliases', null, InputOption::VALUE_NONE, 'Determines if the aliases.sh file is created.')
            ->addOption('example', null, InputOption::VALUE_NONE, 'Determines if a Artestead example file is created.')
            ->addOption('json', null, InputOption::VALUE_NONE, 'Determines if the Artestead settings file will be in json format.');
    }
104161
protected function _set_files(){
    // Shortcuts for files and dir
    if ( isset($this->cfg['params']['f']) ){
      $this->cfg['params']['files'] = $this->cfg['params']['f'];
      unset($this->cfg['params']['f']);
    }
    if ( isset($this->cfg['params']['d']) ){
      $this->cfg['params']['dir'] = $this->cfg['params']['d'];
      unset($this->cfg['params']['d']);
    }
    // File
    if ( !empty($this->cfg['ext']) && is_file($this->fpath.$this->cfg['url']) ){
      $res = $this->get_file();
    }
    // Preconfigured
    else if ( isset($this->cfg['params']['id']) ){
      $res = $this->get_preconfig();
    }
    // List of files
    else if ( isset($this->cfg['params']['files']) && is_dir($this->fpath.$this->cfg['url']) ){
      $res = $this->get_files();
    }
    // Directory content
    // Vue component
    else if ( isset($this->cfg['params']['dir']) && is_dir($this->fpath.$this->cfg['url']) ){
      $res = $this->get_dir();
    }
    else if ( $this->cfg['is_component'] && is_dir($this->fpath.$this->cfg['url']) ){
      //cpStart:
      $res = [];
      $this->cfg['num'] = 0;
      foreach ( $this->cfg['components'] as $i => $cp ){
        if ( !isset($res[$cp]) ){
          $res[$cp] = $this->get_dir($this->cfg['url'].$cp);
          if ( $res[$cp] ){
            $dir = false;
            foreach ( $res[$cp] as $type => $files ){
              if ( !$dir && count($files) ){
                $dir = $this->fpath.\dirname($files[0]);
              }
              $this->cfg['num'] += \count($files);
            }
            /*
            if ( $dir && is_file($dir.'/bbn.json') ){
              $json = json_decode(file_get_contents($dir.'/bbn.json'));
              if ( isset($json->components) ){
                foreach ( $json->components as $tmp ){
                  if ( !isset($res[$tmp]) && !\in_array($tmp, $this->cfg['components'], true) ){
                    $this->cfg['components'][] = $tmp;
                    goto cpStart;
                    break;
                  }
                }
              }
            }
            */
          }
        }
      }
    }
    // Last but not least, libraries!
    else if ( isset($this->cfg['params']['lib']) ){
      $res = $this->get_libs();
      // Adding dirs to config
      if ( !empty($this->cfg['params']['dirs']) ){
        $dirs = explode(',', $this->cfg['params']['dirs']);
        foreach ( $dirs as $d ){
          if ( $r = $this->get_dir($d) ){
            $this->add($res, $r);
          }
        }
      }
    }
    $this->cfg['content'] = $res ?? [];
    return $this;
  }
515240
private function setup()
	{
		$composer_psr4 = dirname(dirname(dirname(__DIR__))).'/composer/autoload_psr4.php';
		if (!file_exists($composer_psr4)) {
			exit("\nI can't find Composer data!");
		}

		$composer = require_once $composer_psr4;
		if (!isset($composer['Config\\'][0])) {
			exit("\nI can't find Composer data!");
		}

		//APP_CONFIGPATH defined in "index.php" or in bootstrape
    	if(!defined('_CONFIGPATH')){
      		define('_CONFIGPATH', isset($composer[''][0]) //Composer fallBack
		       ? $composer[''][0].'/Config' 
		       : dirname($vendorDir).'/Config');
    	}
    	static::$configDir = _CONFIGPATH;
    	static::$vendorDir = $vendorDir;
    	static::$baseDir = defined('_PHPPATH') ? _PHPPATH : dirname($vendorDir);
	}
410694
def insert_system_path(opts, paths):
    '''
    
    '''
    if isinstance(paths, six.string_types):
        paths = [paths]
    for path in paths:
        path_options = {'path': path, 'root_dir': opts['root_dir']}
        prepend_root_dir(path_options, path_options)
        if (os.path.isdir(path_options['path'])
                and path_options['path'] not in sys.path):
            sys.path.insert(0, path_options['path'])
214818
protected function configure()
    {
        $this
        ->setName($this->name)
        ->setDescription($this->description)
        ->setAliases($this->aliases)
        ->addOption(
          'env',
          null,
          InputOption::VALUE_REQUIRED,
          'Set the environment variable file',
          sprintf('%s/%s', getcwd(), '.craftsman')
        );
    }
268005
protected function configureAliases()
    {
        $file = "{$this->basePath}/aliases.sh";
        if (file_exists($file)) {
            $fileContent = file_get_contents($file);
            $fileContent = str_replace(
                'alias p=\'cd ~/Code/artestead\'',
                'alias p=\'cd ~/Code/'.$this->defaultName.'\'',
                $fileContent
            );
            file_put_contents($file, $fileContent);
        }
    }
686862
protected function configure()
    {
        $this->setName(self::COMMAND_NAME);
        $this->setDescription('Import "core_config_data" settings for an environment');
        $this->addArgument('folder', InputArgument::REQUIRED, 'Import folder name');
        $this->addArgument('environment', InputArgument::REQUIRED, 'Environment name. SubEnvs separated by slash e.g.: development/osx/developer01');
        $this->addOption('base', null, InputOption::VALUE_OPTIONAL, 'Base folder name', 'base');
        $this->addOption('format', 'm', InputOption::VALUE_OPTIONAL, 'Format: yaml, json (Default: yaml)', 'yaml');

        parent::configure();
    }
748686
def init():
    """"""
    default_config_path = path.join(
        (os.environ.get('TLDR_CONFIG_DIR') or path.expanduser('~')),
        '.tldrrc')
    if path.exists(default_config_path):
        click.echo("There is already a config file exists, "
                   "skip initializing it.")
    else:
        repo_path = click.prompt("Input the tldr repo path(absolute path)")
        if not path.exists(repo_path):
            sys.exit("Repo path not exist, clone it first.")

        platform = click.prompt("Input your platform(linux, osx or sunos)")
        if platform not in ['linux', 'osx', 'sunos']:
            sys.exit("Platform should be in linux, osx or sunos.")

        colors = {
            "description": "blue",
            "usage": "green",
            "command": "cyan"
        }

        config = {
            "repo_directory": repo_path,
            "colors": colors,
            "platform": platform
        }
        with open(default_config_path, 'w') as f:
            f.write(yaml.safe_dump(config, default_flow_style=False))

        click.echo("Initializing the config file at {0}".format(
            default_config_path))
800917
protected function configure()
	{
		// the short description shown while running "php bin/console list"
		if( $this->docs->getIs("description") )
		{
			$this->setDescription($this->docs["description"]);
		}

		// the full command description shown when running the command with
		// the "--help" option
		if( $this->docs->getIs("help") )
		{
			$this->setHelp($this->docs["help"]);
		}
	}
525236
def setup():
    ""
    parent, project = os.path.split(env.path)

    if not exists(parent):
        run('mkdir -p {0}'.format(parent))
        run('virtualenv {0}'.format(parent))

    with cd(parent):
        if not exists(project):
            run('git clone {repo_url} {project}'.format(project=project, **env))
1173397
def setup(app):
    """"""
    app.add_config_value('jsdoc_source_root', '..', 'env')
    app.add_config_value('jsdoc_output_root', 'javascript', 'env')
    app.add_config_value('jsdoc_exclude', [], 'env')
    app.connect('builder-inited', generate_docs)
446411
def _setup_user_dir(self):
        """"""
        user_dir = self._get_user_dir_path()

        rules_dir = user_dir.joinpath('rules')
        if not rules_dir.is_dir():
            rules_dir.mkdir(parents=True)
        self.user_dir = user_dir
152431
protected function setAppDirectoryNamespace()
	{
		$files = Finder::create()
                            ->in($this->laravel['path'])
                            ->name('*.php');

		foreach ($files as $file)
		{
			$this->replaceNamespace($file->getRealPath());
		}
	}