def zsh(ctx): """Show how to set the environment in the Z shell""" for k, v in sorted(six.iteritems(config.env)): click.echo('export {k}={v}:${k}'.format(k=k, v=double_quote(v))) for k, v in sorted(six.iteritems(config.override_env)): click.echo('export {k}={v}'.format(k=k, v=double_quote(v))) click.echo('# Run this command to configure your shell:') click.echo('# eval $({command})'.format(command=ctx.command_path))
def fish(ctx): """Show how to set the environment in the Friendly interactive shell""" for k, v in sorted(six.iteritems(config.env)): v = v.replace(os.pathsep, ' ') if k == 'PATH' else v click.echo('set -x {k} {v} ${k};'.format(k=k, v=double_quote(v))) for k, v in sorted(six.iteritems(config.override_env)): click.echo('set -x {k} {v};'.format(k=k, v=double_quote(v))) click.echo('# Run this command to configure your shell:') click.echo('# eval ({command})'.format(command=ctx.command_path))
def powershell(ctx): """Show how to set the environment in the Windows PowerShell""" for k, v in sorted(six.iteritems(config.env)): click.echo('$Env:{k} = "{v};" + $Env:{k}'.format(k=k, v=double_quote(v))) for k, v in sorted(six.iteritems(config.override_env)): click.echo('$Env:{k} = "{v}"'.format(k=k, v=double_quote(v))) click.echo('# Run this command to configure your shell:') click.echo( '# & {command} | Invoke-Expression'.format(command=ctx.command_path))
def exec_(launcher_command, launcher, shell, command, stdout, stderr): """Run a command in the CoSMo environment""" if launcher: launcher_command = config.settings2["launchers"][launcher] if shell: command = [ ' '.join([command[0]] + [double_quote(arg) for arg in command[1:]]) ] out = open(stdout, "wb") if stdout else None err = open(stderr, "wb") if stderr else None call(command, shell=shell, stdout=out, stderr=err, launcher_command=launcher_command)