(cli, prog_name, complete_var=None)
Internal handler for the bash completion support.

    Parameters
    ----------
    cli : click.Command
        The main click Command of the program
    prog_name : str
        The program name on the command line
    complete_var : str
        The environment variable name used to control the completion behavior (Default value = None)
Internal handler for the bash completion support.
Internal handler for the bash completion support .
def _shellcomplete(cli, prog_name, complete_var=None):
    """Internal handler for the bash completion support.

    Parameters
    ----------
    cli : click.Command
        The main click Command of the program
    prog_name : str
        The program name on the command line
    complete_var : str
        The environment variable name used to control the completion behavior (Default value = None)
    """
    if complete_var is None:
        complete_var = '_%s_COMPLETE' % (prog_name.replace('-', '_')).upper()
    complete_instr = os.environ.get(complete_var)
    if not complete_instr:
        return

    if complete_instr == 'source':
        echo(get_code(prog_name=prog_name, env_name=complete_var))
    elif complete_instr == 'source-bash':
        echo(get_code('bash', prog_name, complete_var))
    elif complete_instr == 'source-fish':
        echo(get_code('fish', prog_name, complete_var))
    elif complete_instr == 'source-powershell':
        echo(get_code('powershell', prog_name, complete_var))
    elif complete_instr == 'source-zsh':
        echo(get_code('zsh', prog_name, complete_var))
    elif complete_instr in ['complete', 'complete-bash']:
        # keep 'complete' for bash for backward compatibility
        do_bash_complete(cli, prog_name)
    elif complete_instr == 'complete-fish':
        do_fish_complete(cli, prog_name)
    elif complete_instr == 'complete-powershell':
        do_powershell_complete(cli, prog_name)
    elif complete_instr == 'complete-zsh':
        do_zsh_complete(cli, prog_name)
    elif complete_instr == 'install':
        shell, path = install(prog_name=prog_name, env_name=complete_var)
        click.echo('%s completion installed in %s' % (shell, path))
    elif complete_instr == 'install-bash':
        shell, path = install(shell='bash', prog_name=prog_name, env_name=complete_var)
        click.echo('%s completion installed in %s' % (shell, path))
    elif complete_instr == 'install-fish':
        shell, path = install(shell='fish', prog_name=prog_name, env_name=complete_var)
        click.echo('%s completion installed in %s' % (shell, path))
    elif complete_instr == 'install-zsh':
        shell, path = install(shell='zsh', prog_name=prog_name, env_name=complete_var)
        click.echo('%s completion installed in %s' % (shell, path))
    elif complete_instr == 'install-powershell':
        shell, path = install(shell='powershell', prog_name=prog_name, env_name=complete_var)
        click.echo('%s completion installed in %s' % (shell, path))
    sys.exit()
def _shellcomplete ( cli , prog_name , complete_var = None ) : if complete_var is None : complete_var = '_%s_COMPLETE' % ( prog_name . replace ( '-' , '_' ) ) . upper ( ) complete_instr = os . environ . get ( complete_var ) if not complete_instr : return if complete_instr == 'source' : echo ( get_code ( prog_name = prog_name , env_name = complete_var ) ) elif complete_instr == 'source-bash' : echo ( get_code ( 'bash' , prog_name , complete_var ) ) elif complete_instr == 'source-fish' : echo ( get_code ( 'fish' , prog_name , complete_var ) ) elif complete_instr == 'source-powershell' : echo ( get_code ( 'powershell' , prog_name , complete_var ) ) elif complete_instr == 'source-zsh' : echo ( get_code ( 'zsh' , prog_name , complete_var ) ) elif complete_instr in [ 'complete' , 'complete-bash' ] : # keep 'complete' for bash for backward compatibility do_bash_complete ( cli , prog_name ) elif complete_instr == 'complete-fish' : do_fish_complete ( cli , prog_name ) elif complete_instr == 'complete-powershell' : do_powershell_complete ( cli , prog_name ) elif complete_instr == 'complete-zsh' : do_zsh_complete ( cli , prog_name ) elif complete_instr == 'install' : shell , path = install ( prog_name = prog_name , env_name = complete_var ) click . echo ( '%s completion installed in %s' % ( shell , path ) ) elif complete_instr == 'install-bash' : shell , path = install ( shell = 'bash' , prog_name = prog_name , env_name = complete_var ) click . echo ( '%s completion installed in %s' % ( shell , path ) ) elif complete_instr == 'install-fish' : shell , path = install ( shell = 'fish' , prog_name = prog_name , env_name = complete_var ) click . echo ( '%s completion installed in %s' % ( shell , path ) ) elif complete_instr == 'install-zsh' : shell , path = install ( shell = 'zsh' , prog_name = prog_name , env_name = complete_var ) click . echo ( '%s completion installed in %s' % ( shell , path ) ) elif complete_instr == 'install-powershell' : shell , path = install ( shell = 'powershell' , prog_name = prog_name , env_name = complete_var ) click . echo ( '%s completion installed in %s' % ( shell , path ) ) sys . exit ( )