Show (print out) current environment variables.
765258
def show():
    """"""
    env = get_environment()

    for key, val in sorted(env.env.items(), key=lambda item: item[0]):
        click.secho('%s = %s' % (key, val))
80446
def show_deps(self):
        

        pkgs = pkg_resources.Environment()

        for pkg in pkgs[self.project_name]:
            if not self.version:
                print(pkg.project_name, pkg.version)

            i = len(pkg._dep_map.values()[0])
            if i:
                while i:
                    if not self.version or self.version and \
                            pkg.version == self.version:
                        if self.version and i == len(pkg._dep_map.values()[0]):
                            print(pkg.project_name, pkg.version)
                        print("  " + str(pkg._dep_map.values()[0][i - 1]))
                    i -= 1
            else:
                self.logger.info(\
                    "No dependency information was supplied with the package.")
                return 1
        return 0
310468
def get_printout(out, opts=None, **kwargs):
    '''
    
    '''
    if opts is None:
        opts = {}

    if 'output' in opts and opts['output'] != 'highstate':
        # new --out option, but don't choke when using --out=highstate at CLI
        # See Issue #29796 for more information.
        out = opts['output']

    # Handle setting the output when --static is passed.
    if not out and opts.get('static'):
        if opts.get('output'):
            out = opts['output']
        elif opts.get('fun', '').split('.')[0] == 'state':
            # --static doesn't have an output set at this point, but if we're
            # running a state function and "out" hasn't already been set, we
            # should set the out variable to "highstate". Otherwise state runs
            # are set to "nested" below. See Issue #44556 for more information.
            out = 'highstate'

    if out == 'text':
        out = 'txt'
    elif out is None or out == '':
        out = 'nested'
    if opts.get('progress', False):
        out = 'progress'

    opts.update(kwargs)
    if 'color' not in opts:
        def is_pipe():
            '''
            Check if sys.stdout is a pipe or not
            '''
            try:
                fileno = sys.stdout.fileno()
            except (AttributeError, io.UnsupportedOperation):
                fileno = -1  # sys.stdout is StringIO or fake
            return not os.isatty(fileno)

        if opts.get('force_color', False):
            opts['color'] = True
        elif opts.get('no_color', False) or is_pipe() or salt.utils.platform.is_windows():
            opts['color'] = False
        else:
            opts['color'] = True
    else:
        if opts.get('force_color', False):
            opts['color'] = True
        elif opts.get('no_color', False) or salt.utils.platform.is_windows():
            opts['color'] = False
        else:
            pass

    outputters = salt.loader.outputters(opts)
    if out not in outputters:
        # Since the grains outputter was removed we don't need to fire this
        # error when old minions are asking for it
        if out != 'grains':
            log.error('Invalid outputter %s specified, falling back to nested', out)
        return outputters['nested']
    return outputters[out]
1114952
def get_env_variable(var_name, default=None):
    """"""
    try:
        return os.environ[var_name]
    except KeyError:
        if default is not None:
            return default
        else:
            error_msg = 'The environment variable {} was missing, abort...'\
                        .format(var_name)
            raise EnvironmentError(error_msg)
1062556
def env_info():
    '''
    
    '''
    v = sys.version_info
    pyver = f'Python {v.major}.{v.minor}.{v.micro}'
    if v.releaselevel == 'alpha':
        pyver += 'a'
    if v.releaselevel == 'beta':
        pyver += 'b'
    if v.releaselevel == 'candidate':
        pyver += 'rc'
    if v.releaselevel != 'final':
        pyver += str(v.serial)
    return f'{pyver} (env: {sys.prefix})'
926485
def show(config_file=False):
    '''
    
    '''
    cmd = 'sysctl'
    ret = {}
    out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')
    for line in out.splitlines():
        if not line or '=' not in line:
            continue
        comps = line.split('=', 1)
        ret[comps[0]] = comps[1]
    return ret
1075934
def _print_napps(cls, napp_list):
        """"""
        mgr = NAppsManager()
        enabled = mgr.get_enabled()
        installed = mgr.get_installed()
        napps = []
        for napp, desc in sorted(napp_list):
            status = 'i' if napp in installed else '-'
            status += 'e' if napp in enabled else '-'
            status = '[{}]'.format(status)
            name = '{}/{}'.format(*napp)
            napps.append((status, name, desc))
        cls.print_napps(napps)
276089
def print_global_config(global_config):
    
    if global_config.has_section('shell'):
        print("\nShell configurations:")
        for shell_type, set_value in global_config.items('shell'):
            print("{0}: {1}".format(shell_type, set_value))

    if global_config.has_option('global', 'env_source_rc'):
        print("\nHave sprinter env source rc: {0}".format(
            global_config.get('global', 'env_source_rc')))
560448
def update_environment_variables(self, filename):
        """"""
        self.env.update({'PIPELINE_BASH_FILE_ORIGINAL': filename})
        filename = os.path.join('/root/scripts', os.path.basename(filename))
        self.env.update({'PIPELINE_BASH_FILE': filename})

        # remove those keys for Docker since the paths inside Docker are different
        os_environ = os.environ.copy()
        for remove_variable in ['PATH', 'PYTHONPATH', 'JAVA_HOME', 'HOME']:
            os_environ.pop(remove_variable, None)

        self.env.update(os_environ)
604722
private Properties getEnvironmentVariables() throws Throwable {
		Properties environmentVariables = new Properties();
		String operatingSystem = System.getProperty("os.name").toLowerCase();
		Runtime runtime = Runtime.getRuntime();
		Process process = null;
		if (operatingSystem.startsWith("windows 95")
				|| operatingSystem.startsWith("windows 98")
				|| operatingSystem.startsWith("me")) {
			process = runtime.exec("command.com /c set");
		} else if (operatingSystem.startsWith("windows")) {
			// Modern windows
			process = runtime.exec("cmd.exe /c set");
		} else {
			process = runtime.exec("env");
		}
		BufferedReader environmentStream = new BufferedReader(new InputStreamReader(process.getInputStream()));
		String inputLine = "";
		int idx = -1;
		while ((inputLine = environmentStream.readLine()) != null) {
			idx = inputLine.indexOf('=');
			environmentVariables.setProperty(inputLine.substring(0, idx),
					inputLine.substring(idx + 1));
		}
		return environmentVariables;
	}
89505
def list_envs():
    """"""
    for env in lib.get_environments():
        margin_left = lib.get_margin(len(env['name']))
        print("{0}{1}{2}".format(
            env['name'], margin_left,
            env.get('description', '(no description)')))
441644
def show(config_file=False):
    '''
    
    '''
    roots = (
        'kern',
        'vm',
        'vfs',
        'net',
        'hw',
        'machdep',
        'user',
        'ddb',
        'proc',
        'emul',
        'security',
        'init'
    )
    cmd = 'sysctl -ae'
    ret = {}
    out = __salt__['cmd.run'](cmd, output_loglevel='trace')
    comps = ['']
    for line in out.splitlines():
        if any([line.startswith('{0}.'.format(root)) for root in roots]):
            comps = re.split('[=:]', line, 1)
            ret[comps[0]] = comps[1]
        elif comps[0]:
            ret[comps[0]] += '{0}\n'.format(line)
        else:
            continue
    return ret
727275
def show(all_keys):
    """"""
    if not config_file_exists():
        echo_info('No config file found! Please try `ddev config restore`.')
    else:
        if all_keys:
            echo_info(read_config_file().rstrip())
        else:
            echo_info(read_config_file_scrubbed().rstrip())
233442
def show(config):
    """"""
    with open(config, 'r'):
        main.show(yaml.load(open(config)))
527445
def write_env_vars(env_vars=None):  # type: (dict) -> None
    
    env_vars = env_vars or {}
    env_vars['PYTHONPATH'] = ':'.join(sys.path)

    for name, value in env_vars.items():
        os.environ[name] = value
1290413
def override_env_variables():
    """"""
    env_vars = ("LOGNAME", "USER", "LNAME", "USERNAME")
    old = [os.environ[v] if v in os.environ else None for v in env_vars]

    for v in env_vars:
        os.environ[v] = "test"
    yield

    for i, v in enumerate(env_vars):
        if old[i]:
            os.environ[v] = old[i]
313593
def debug(self):  # pragma: no cover
        """"""

        print("Aliases:")
        pprint.pprint(self._aliases)
        print("Override:")
        pprint.pprint(self._override)
        print("Args:")
        pprint.pprint(self._args)
        print("Env:")
        pprint.pprint(self._env)
        print("Config:")
        pprint.pprint(self._config)
        print("Key/Value Store:")
        pprint.pprint(self._kvstore)
        print("Defaults:")
        pprint.pprint(self._defaults)