mirror of https://github.com/tqdm/tqdm.git
minor tidy
This commit is contained in:
parent
27e9338f24
commit
8d0e68350a
|
@ -8,23 +8,21 @@ from io import open as io_open
|
||||||
from os import path
|
from os import path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
RE_OPT = re.compile(r'(\w+) :', flags=re.M)
|
||||||
|
|
||||||
|
|
||||||
def doc2opt(doc):
|
def doc2opt(doc):
|
||||||
"""
|
"""
|
||||||
doc : str, document to parse
|
doc : str, document to parse
|
||||||
"""
|
"""
|
||||||
options = ['--' + i.strip(' :') for i in re.findall(r'\w+ :', doc)]
|
return {'--' + i for i in RE_OPT.findall(doc)}
|
||||||
return options
|
|
||||||
|
|
||||||
# CLI options
|
# CLI options
|
||||||
options = ['-h', '--help', '-v', '--version']
|
options = {'-h', '--help', '-v', '--version'}
|
||||||
options += doc2opt(tqdm.tqdm.__init__.__doc__)
|
options ^= doc2opt(tqdm.tqdm.__init__.__doc__)
|
||||||
options += doc2opt(tqdm.cli.CLI_EXTRA_DOC)
|
options ^= doc2opt(tqdm.cli.CLI_EXTRA_DOC)
|
||||||
|
options -= {'--name'} ^ {'--' + i for i in tqdm.cli.UNSUPPORTED_OPTS}
|
||||||
# Remove options without CLI support
|
|
||||||
no_support = ['--' + i for i in tqdm.cli.UNSUPPORTED_OPTS]
|
|
||||||
# TODO: Check and remove option `name`
|
|
||||||
no_support += ['--name']
|
|
||||||
options = list(set(options) - set(no_support))
|
|
||||||
|
|
||||||
src_dir = path.abspath(path.dirname(__file__))
|
src_dir = path.abspath(path.dirname(__file__))
|
||||||
completion = u"""\
|
completion = u"""\
|
||||||
|
|
Loading…
Reference in New Issue