@group(cls=PipenvGroup, invoke_without_command=True, context_settings=CONTEXT_SETTINGS)
@option('--where', is_flag=True, default=False, help='Output project home information.')
@option('--venv', is_flag=True, default=False, help='Output virtualenv information.')
@option('--py', is_flag=True, default=False, help='Output Python interpreter information.')
@option('--envs', is_flag=True, default=False, help='Output Environment Variable options.')
@option('--rm', is_flag=True, default=False, help='Remove the virtualenv.')
@option('--bare', is_flag=True, default=False, help='Minimal output.')
@option('--completion', is_flag=True, default=False, help="Output completion (to be eval'd).")
@option('--man', is_flag=True, default=False, help='Display manpage.')
@option('--three/--two', is_flag=True, default=None, help='Use Python 3/2 when creating virtualenv.')
@option('--python', default=False, nargs=1, callback=validate_python_path, help='Specify which version of Python virtualenv should use.')
@option('--site-packages', is_flag=True, default=False, help='Enable site-packages for the virtualenv.')
@version_option(prog_name=crayons.normal('pipenv', bold=True), version=__version__)
@pass_context
def cli(ctx, where=False, venv=False, rm=False, bare=False, three=False, python=False, help=False, py=False, site_packages=False, envs=False, man=False, completion=False):
    if completion:
        if PIPENV_SHELL:
            echo(get_code(shell=PIPENV_SHELL.split(os.sep)[(- 1)], prog_name='pipenv'))
        else:
            echo('Please ensure that the {0} environment variable is set.'.format(crayons.normal('SHELL', bold=True)), err=True)
            sys.exit(1)
        sys.exit(0)
    from .core import system_which, do_py, warn_in_virtualenv, do_where, project, spinner, cleanup_virtualenv, ensure_project, format_help
    if man:
        if system_which('man'):
            path = os.sep.join([os.path.dirname(__file__), 'pipenv.1'])
            os.execle(system_which('man'), 'man', path, os.environ)
        else:
            echo('man does not appear to be available on your system.', err=True)
    if envs:
        echo('The following environment variables can be set, to do various things:\n')
        for key in environments.__dict__:
            if key.startswith('PIPENV'):
                echo('  - {0}'.format(crayons.normal(key, bold=True)))
        echo('\nYou can learn more at:\n   {0}'.format(crayons.green('http://docs.pipenv.org/advanced/#configuration-with-environment-variables')))
        sys.exit(0)
    warn_in_virtualenv()
    if (ctx.invoked_subcommand is None):
        if where:
            do_where(bare=True)
            sys.exit(0)
        elif py:
            do_py()
            sys.exit()
        elif venv:
            if (not project.virtualenv_exists):
                echo(crayons.red('No virtualenv has been created for this project yet!'), err=True)
                sys.exit(1)
            else:
                echo(project.virtualenv_location)
                sys.exit(0)
        elif rm:
            if PIPENV_USE_SYSTEM:
                echo(crayons.red('You are attempting to remove a virtualenv that Pipenv did not create. Aborting.'))
                sys.exit(1)
            if project.virtualenv_exists:
                loc = project.virtualenv_location
                echo(crayons.normal(u'{0} ({1})…'.format(crayons.normal('Removing virtualenv', bold=True), crayons.green(loc))))
                with spinner():
                    cleanup_virtualenv(bare=True)
                sys.exit(0)
            else:
                echo(crayons.red('No virtualenv has been created for this project yet!', bold=True), err=True)
                sys.exit(1)
    if ((python or (three is not None)) or site_packages):
        ensure_project(three=three, python=python, warn=True, site_packages=site_packages)
    elif (ctx.invoked_subcommand is None):
        echo(format_help(ctx.get_help()))
@group(cls=PipenvGroup, invoke_without_command=True, context_settings=CONTEXT_SETTINGS)
@option('--where', is_flag=True, default=False, help='Output project home information.')
@option('--venv', is_flag=True, default=False, help='Output virtualenv information.')
@option('--py', is_flag=True, default=False, help='Output Python interpreter information.')
@option('--envs', is_flag=True, default=False, help='Output Environment Variable options.')
@option('--rm', is_flag=True, default=False, help='Remove the virtualenv.')
@option('--bare', is_flag=True, default=False, help='Minimal output.')
@option('--completion', is_flag=True, default=False, help="Output completion (to be eval'd).")
@option('--man', is_flag=True, default=False, help='Display manpage.')
@option('--three/--two', is_flag=True, default=None, help='Use Python 3/2 when creating virtualenv.')
@option('--python', default=False, nargs=1, callback=validate_python_path, help='Specify which version of Python virtualenv should use.')
@option('--site-packages', is_flag=True, default=False, help='Enable site-packages for the virtualenv.')
@version_option(prog_name=crayons.normal('pipenv', bold=True), version=__version__)
@pass_context
def cli(ctx, where=False, venv=False, rm=False, bare=False, three=False, python=False, help=False, py=False, site_packages=False, envs=False, man=False, completion=False):
    if completion:
        if PIPENV_SHELL:
            echo(get_code(shell=PIPENV_SHELL.split(os.sep)[(- 1)], prog_name='pipenv'))
        else:
            echo('Please ensure that the {0} environment variable is set.'.format(crayons.normal('SHELL', bold=True)), err=True)
            sys.exit(1)
        sys.exit(0)
    from .core import system_which, do_py, warn_in_virtualenv, do_where, project, spinner, cleanup_virtualenv, ensure_project, format_help
    if man:
        if system_which('man'):
            path = os.sep.join([os.path.dirname(__file__), 'pipenv.1'])
            os.execle(system_which('man'), 'man', path, os.environ)
        else:
            echo('man does not appear to be available on your system.', err=True)
    if envs:
        echo('The following environment variables can be set, to do various things:\n')
        for key in environments.__dict__:
            if key.startswith('PIPENV'):
                echo('  - {0}'.format(crayons.normal(key, bold=True)))
        echo('\nYou can learn more at:\n   {0}'.format(crayons.green('http://docs.pipenv.org/advanced/#configuration-with-environment-variables')))
        sys.exit(0)
    warn_in_virtualenv()
    if (ctx.invoked_subcommand is None):
        if where:
            do_where(bare=True)
            sys.exit(0)
        elif py:
            do_py()
            sys.exit()
        elif venv:
            if (not project.virtualenv_exists):
                echo(crayons.red('No virtualenv has been created for this project yet!'), err=True)
                sys.exit(1)
            else:
                echo(project.virtualenv_location)
                sys.exit(0)
        elif rm:
            if PIPENV_USE_SYSTEM:
                echo(crayons.red('You are attempting to remove a virtualenv that Pipenv did not create. Aborting.'))
                sys.exit(1)
            if project.virtualenv_exists:
                loc = project.virtualenv_location
                echo(crayons.normal(u'{0} ({1})…'.format(crayons.normal('Removing virtualenv', bold=True), crayons.green(loc))))
                with spinner():
                    cleanup_virtualenv(bare=True)
                sys.exit(0)
            else:
                echo(crayons.red('No virtualenv has been created for this project yet!', bold=True), err=True)
                sys.exit(1)
    if ((python or (three is not None)) or site_packages):
        ensure_project(three=three, python=python, warn=True, site_packages=site_packages)
    elif (ctx.invoked_subcommand is None):
        echo(format_help(ctx.get_help()))