Ejemplo n.º 1
0
def shell(shell, install):
    '''Installs or prints shell code for completions.'''
    try:
        if not shell:
            shell = click_completion.get_auto_shell(),
    except click.exceptions.UsageError as e:
        print(e.message)

    if install:
        click_completion.install(shell)
    else:
        click.echo(click_completion.get_code(shell))
Ejemplo n.º 2
0
def install_completion(ctx, attr, value):
    """Installs click_completion tab expansion into users shell"""
    if not value or ctx.resilient_parsing:
        return value
    shell, path = click_completion.install()
    click.echo('%s completion installed in %s' % (shell, path))
    exit(0)
Ejemplo n.º 3
0
def install_completion_code(shell, path):
    import click_completion  # pylint: disable=import-error,import-outside-toplevel

    if is_completion_code_installed(shell, path):
        return None

    return click_completion.install(shell=shell,
                                    path=path,
                                    append=shell != "fish")
Ejemplo n.º 4
0
def setup_completion(shell, show_code):
    """Setup CLI completion for shell"""
    click.echo('Setup completion for shell {!r}'.format(shell))

    if show_code:
        code = click_completion.get_code(shell=shell)
        click.echo('Installing code: \n{}'.format(code))

    shell_, path = click_completion.install(shell=shell)
    click.secho('Installed completion in path {!r}'.format(path))
Ejemplo n.º 5
0
def install(append, shell, path):
    """Install the completion"""
    extra_env = {
        CASE_INSENSITIVE_ENV: 'ON'
    } if config.completion.case_insensitive else {}
    if not config.dry_run:
        shell, path = click_completion.install(shell=shell,
                                               path=path,
                                               append=append,
                                               extra_env=extra_env)
        LOGGER.info('%s completion installed in %s' % (shell, path))
Ejemplo n.º 6
0
def install(append, case_insensitive, shell, path):
    """Install the click-completion-command completion"""
    extra_env = {'_CLICK_COMPLETION_COMMAND_CASE_INSENSITIVE_COMPLETE': 'ON'} if case_insensitive else {}
    shell, path = click_completion.install(shell=shell, path=path, append=append, extra_env=extra_env)
    click.echo('%s completion installed in %s' % (shell, path))
Ejemplo n.º 7
0
def autocomplete_callback(ctx, attr, value):
    if not value or ctx.resilient_parsing:
        return value
    shell, path = click_completion.install()
    click.echo("{} completion installed in {}".format(shell, path))
    exit(0)
Ejemplo n.º 8
0
from . import day_13
from . import day_14
from . import day_15
from . import day_16
from . import day_17
from . import day_18

from . import day_20
from . import day_21
from . import day_22
from . import day_23
from . import day_24
from . import day_25

click_completion.init()
click_completion.install(shell="fish", prog_name="aoc-2017")
click_completion.install(shell="bash", prog_name="aoc-2017")


@click.group()
def cli_entry_point():
    if 'AOC_SESSION' not in os.environ:
        raise ValueError("Environment variable AOC_SESSION is missing, "
                         "which is needed to download the test input. ")


cli_entry_point.add_command(day_1.main, name="day-1")
cli_entry_point.add_command(day_2.main, name="day-2")
cli_entry_point.add_command(day_3.main, name="day-3")
cli_entry_point.add_command(day_4.main, name="day-4")
cli_entry_point.add_command(day_5.main, name="day-5")