From 1d021cd3ffabb718c3ea43dc5b64e3567fec2e8c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 28 Feb 2018 09:33:17 -0500 Subject: [PATCH] add update back, sorta Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 38 ++++++++++++++++++++++++++++++++++++++ pipenv/core.py | 1 + 2 files changed, 39 insertions(+) diff --git a/pipenv/cli.py b/pipenv/cli.py index 7ba65690..c8151cfa 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -315,6 +315,43 @@ def check(three=None, python=False, system=False, unused=False, style=False, arg core.do_check(three=three, python=python, system=system, unused=unused, args=args) +@click.command(short_help="Runs lock, then sync.") +@click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.") +@click.option('--python', default=False, nargs=1, help="Specify which version of Python virtualenv should use.") +@click.option('--system', is_flag=True, default=False, help="Use system Python.") +@click.option('--verbose', '-v', is_flag=True, default=False, help="Verbose mode.", callback=setup_verbose) +@click.option('--dev', '-d', is_flag=True, default=False, help="Install package(s) in [dev-packages].") +@click.option('--clear', is_flag=True, default=False, help="Clear the dependency cache.") +@click.option('--bare', is_flag=True, default=False, help="Minimal output.") +@click.option('--pre', is_flag=True, default=False, help=u"Allow pre–releases.") +@click.option('--keep-outdated', is_flag=True, default=False, help=u"Keep out–dated dependencies from being updated in Pipfile.lock.") +@click.option('--sequential', is_flag=True, default=False, help="Install dependencies one-at-a-time, instead of concurrently.") +@click.pass_context +def update(ctx, three=None, python=False, system=False, verbose=False, clear=False, keep_outdated=False, pre=False, dev=False, bare=False, sequential=False): + from . import core + + click.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), + )) + + # Load the --pre settings from the Pipfile. + if not pre: + pre = core.project.settings.get('pre') + + core.do_lock(verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated) + core.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 + ) + + + + @click.command(short_help=u"Displays currently–installed dependency graph information.") @click.option('--bare', is_flag=True, default=False, help="Minimal output.") @click.option('--json', is_flag=True, default=False, help="Output JSON.") @@ -399,6 +436,7 @@ cli.add_command(check) cli.add_command(clean) cli.add_command(shell) cli.add_command(run) +cli.add_command(update) cli.add_command(run_open) diff --git a/pipenv/core.py b/pipenv/core.py index 941ade28..efa5c491 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1550,6 +1550,7 @@ def format_help(help): help = help.replace(' shell', str(crayons.yellow(' shell', bold=True))) help = help.replace(' sync', str(crayons.green(' sync', bold=True))) help = help.replace(' uninstall', str(crayons.magenta(' uninstall', bold=True))) + help = help.replace(' update', str(crayons.green(' update', bold=True))) additional_help = """ Usage Examples: