(cwords, cword, opts)
Get the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
Get the type of path completion (``file``, ``dir``, ``path`` or None)
Get the type of path completion ( file dir path or None )
def get_path_completion_type(cwords, cword, opts):
    """Get the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
    """
    if cword < 2 or not cwords[cword - 2].startswith('-'):
        return
    for opt in opts:
        if opt.help == optparse.SUPPRESS_HELP:
            continue
        for o in str(opt).split('/'):
            if cwords[cword - 2].split('=')[0] == o:
                if not opt.metavar or any(
                        x in ('path', 'file', 'dir')
                        for x in opt.metavar.split('/')):
                    return opt.metavar
def get_path_completion_type ( cwords , cword , opts ) : if cword < 2 or not cwords [ cword - 2 ] . startswith ( '-' ) : return for opt in opts : if opt . help == optparse . SUPPRESS_HELP : continue for o in str ( opt ) . split ( '/' ) : if cwords [ cword - 2 ] . split ( '=' ) [ 0 ] == o : if not opt . metavar or any ( x in ( 'path' , 'file' , 'dir' ) for x in opt . metavar . split ( '/' ) ) : return opt . metavar