Show the generic tools in the README.

This commit is contained in:
Andrew Hamilton 2017-07-19 09:40:54 +01:00
parent cbdbac0219
commit 0b6fbec3da
3 changed files with 9 additions and 6 deletions

View file

@ -25,6 +25,7 @@ then to run:
Extensions | Tools
---------- | -----
.* | [contents](http://pygments.org/) • metadata
.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://www.mypy-lang.org/) • [python_coverage](http://nedbatchelder.com/code/coverage/) • [pycodestyle](https://pypi.python.org/pypi/pycodestyle) • [pyflakes](https://launchpad.net/pyflakes) • [pylint](http://www.pylint.org/) • [python_gut](https://github.com/ahamilton/vigil/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [python_mccabe](https://github.com/flintwork/mccabe) • [bandit](https://wiki.openstack.org/wiki/Security/Projects/Bandit)
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
.pod .pod6 | [perldoc](http://perldoc.perl.org/)

View file

@ -42,6 +42,7 @@ then to run:
Extensions | Tools
---------- | -----""")
for extensions, tools_ in tools.TOOLS_FOR_EXTENSIONS:
all_tools = [(["*"], tools.generic_tools())] + tools.TOOLS_FOR_EXTENSIONS
for extensions, tools_ in all_tools:
print("%s | %s" % (" ".join("." + extension for extension in extensions),
"".join(tool_markup(tool) for tool in tools_)))

View file

@ -277,7 +277,8 @@ def metadata(path):
@deps(deps={"python3-pygments"}, arch_deps={"python-pygments"},
opensuse_deps={"python3-Pygments"}, gentoo_deps={"pygments"})
opensuse_deps={"python3-Pygments"}, gentoo_deps={"pygments"},
url="python3-pygments")
def contents(path):
root, ext = splitext(path)
if ext == "":
@ -829,7 +830,7 @@ class Result:
return [status_to_str(self.status)]
def _generic_tools():
def generic_tools():
return [contents, metadata]
@ -885,7 +886,7 @@ def _tools_for_extension():
def tools_all():
tools_ = set(_generic_tools())
tools_ = set(generic_tools())
tools_.add(git_blame)
for tool_list in _tools_for_extension().values():
tools_.update(set(tool_list))
@ -922,7 +923,7 @@ def tools_for_path(path):
git_tools = [git_blame] if os.path.exists(".git") else []
root, ext = splitext(path)
extra_tools = [] if ext == "" else _tools_for_extension().get(ext[1:], [])
return _generic_tools() + git_tools + extra_tools
return generic_tools() + git_tools + extra_tools
def run_tool_no_error(path, tool):
@ -972,7 +973,7 @@ def path_colored(path):
@functools.lru_cache(maxsize=100)
def tool_name_colored(tool, path):
char_style = (termstr.CharStyle(is_bold=True) if tool in _generic_tools()
char_style = (termstr.CharStyle(is_bold=True) if tool in generic_tools()
else _charstyle_of_path(path))
return termstr.TermStr(tool.__name__, char_style)