@command(short_help='Runs lock, then sync.')
@argument('more_packages', nargs=(- 1))
@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('--pypi-mirror', default=PIPENV_PYPI_MIRROR, nargs=1, callback=validate_pypi_mirror, help='Specify a PyPI mirror.')
@option('--verbose', '-v', is_flag=True, default=False, help='Verbose mode.', callback=setup_verbose)
@option('--dev', '-d', is_flag=True, default=False, help='Install package(s) in [dev-packages].')
@option('--clear', is_flag=True, default=False, help='Clear the dependency cache.')
@option('--bare', is_flag=True, default=False, help='Minimal output.')
@option('--pre', is_flag=True, default=False, help=u'Allow pre–releases.')
@option('--keep-outdated', is_flag=True, default=False, help=u'Keep out–dated dependencies from being updated in Pipfile.lock.')
@option('--sequential', is_flag=True, default=False, help='Install dependencies one-at-a-time, instead of concurrently.')
@option('--outdated', is_flag=True, default=False, help=u'List out–of–date dependencies.')
@option('--dry-run', is_flag=True, default=None, help=u'List out–of–date dependencies.')
@argument('package', default=False)
@pass_context
def update(ctx, three=None, python=False, pypi_mirror=None, system=False, verbose=False, clear=False, keep_outdated=False, pre=False, dev=False, bare=False, sequential=False, package=None, dry_run=None, outdated=False, more_packages=None):
    from .core import ensure_project, do_outdated, do_lock, do_sync, ensure_lockfile, do_install, project
    ensure_project(three=three, python=python, warn=True)
    if (not outdated):
        outdated = bool(dry_run)
    if outdated:
        do_outdated(pypi_mirror=pypi_mirror)
    if (not package):
        echo('{0} {1} {2} {3}{4}'.format(crayons.white('Running', bold=True), crayons.red('$ pipenv lock', bold=True), crayons.white('then', bold=True), crayons.red('$ pipenv sync', bold=True), crayons.white('.', bold=True)))
        do_lock(verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
        do_sync(ctx=ctx, install=install, dev=dev, three=three, python=python, bare=bare, dont_upgrade=False, user=False, verbose=verbose, clear=clear, unused=False, sequential=sequential, pypi_mirror=pypi_mirror)
    else:
        for package in (([package] + list(more_packages)) or []):
            if (package not in project.all_packages):
                echo('{0}: {1} was not found in your Pipfile! Aborting.'.format(crayons.red('Warning', bold=True), crayons.green(package, bold=True)), err=True)
                sys.exit(1)
        ensure_lockfile(keep_outdated=project.lockfile_exists, pypi_mirror=pypi_mirror)
        do_install(package_name=package, more_packages=more_packages, dev=dev, three=three, python=python, pypi_mirror=pypi_mirror, system=system, lock=True, ignore_pipfile=False, skip_lock=False, verbose=verbose, requirements=False, sequential=sequential, pre=pre, code=False, deploy=False, keep_outdated=True, selective_upgrade=True)
@command(short_help='Runs lock, then sync.')
@argument('more_packages', nargs=(- 1))
@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('--pypi-mirror', default=PIPENV_PYPI_MIRROR, nargs=1, callback=validate_pypi_mirror, help='Specify a PyPI mirror.')
@option('--verbose', '-v', is_flag=True, default=False, help='Verbose mode.', callback=setup_verbose)
@option('--dev', '-d', is_flag=True, default=False, help='Install package(s) in [dev-packages].')
@option('--clear', is_flag=True, default=False, help='Clear the dependency cache.')
@option('--bare', is_flag=True, default=False, help='Minimal output.')
@option('--pre', is_flag=True, default=False, help=u'Allow pre–releases.')
@option('--keep-outdated', is_flag=True, default=False, help=u'Keep out–dated dependencies from being updated in Pipfile.lock.')
@option('--sequential', is_flag=True, default=False, help='Install dependencies one-at-a-time, instead of concurrently.')
@option('--outdated', is_flag=True, default=False, help=u'List out–of–date dependencies.')
@option('--dry-run', is_flag=True, default=None, help=u'List out–of–date dependencies.')
@argument('package', default=False)
@pass_context
def update(ctx, three=None, python=False, pypi_mirror=None, system=False, verbose=False, clear=False, keep_outdated=False, pre=False, dev=False, bare=False, sequential=False, package=None, dry_run=None, outdated=False, more_packages=None):
    from .core import ensure_project, do_outdated, do_lock, do_sync, ensure_lockfile, do_install, project
    ensure_project(three=three, python=python, warn=True)
    if (not outdated):
        outdated = bool(dry_run)
    if outdated:
        do_outdated(pypi_mirror=pypi_mirror)
    if (not package):
        echo('{0} {1} {2} {3}{4}'.format(crayons.white('Running', bold=True), crayons.red('$ pipenv lock', bold=True), crayons.white('then', bold=True), crayons.red('$ pipenv sync', bold=True), crayons.white('.', bold=True)))
        do_lock(verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
        do_sync(ctx=ctx, install=install, dev=dev, three=three, python=python, bare=bare, dont_upgrade=False, user=False, verbose=verbose, clear=clear, unused=False, sequential=sequential, pypi_mirror=pypi_mirror)
    else:
        for package in (([package] + list(more_packages)) or []):
            if (package not in project.all_packages):
                echo('{0}: {1} was not found in your Pipfile! Aborting.'.format(crayons.red('Warning', bold=True), crayons.green(package, bold=True)), err=True)
                sys.exit(1)
        ensure_lockfile(keep_outdated=project.lockfile_exists, pypi_mirror=pypi_mirror)
        do_install(package_name=package, more_packages=more_packages, dev=dev, three=three, python=python, pypi_mirror=pypi_mirror, system=system, lock=True, ignore_pipfile=False, skip_lock=False, verbose=verbose, requirements=False, sequential=sequential, pre=pre, code=False, deploy=False, keep_outdated=True, selective_upgrade=True)