tools: Add git diff.
- This is worth it afterall. - Eris will get out of sync when the diffs are commited, but this is also true of git-blame and git-log. - The user can refresh the old results with shift-r.
This commit is contained in:
parent
c5efd3a74b
commit
071096821c
4 changed files with 14 additions and 5 deletions
|
|
@ -46,9 +46,9 @@ There is a wrapper script available to make running easier:
|
|||
|
||||
## Tools
|
||||
|
||||
File types(100) | Tools(59)
|
||||
File types(100) | Tools(60)
|
||||
----------:| -----
|
||||
.* | [contents](http://pygments.org/) • [metadata](https://github.com/ahamilton/eris) • [git_blame](https://git-scm.com/docs/git-blame) • [git_log](https://git-scm.com/docs/git-log)
|
||||
.* | [contents](http://pygments.org/) • [metadata](https://github.com/ahamilton/eris) • [git_diff](https://git-scm.com/docs/git-diff) • [git_blame](https://git-scm.com/docs/git-blame) • [git_log](https://git-scm.com/docs/git-log)
|
||||
.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pytest](https://docs.pytest.org/en/latest/) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://mypy-lang.org/) • [python_coverage](https://coverage.readthedocs.io/) • [pycodestyle](http://pycodestyle.pycqa.org/en/latest/) • [pydocstyle](http://www.pydocstyle.org/en/2.1.1/usage.html) • [pyflakes](https://pypi.org/project/pyflakes/) • [pylint](https://www.pylint.org/) • [python_gut](https://github.com/ahamilton/eris) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [dis](https://docs.python.org/3/library/dis.html) • [python_mccabe](https://pypi.org/project/mccabe/) • [bandit](https://pypi.org/project/bandit/)
|
||||
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/)
|
||||
.p6 .pm6 | [perl6_syntax](https://rakudo.org/)
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ def make_tool_function(dependencies, command, url=None, success_status=None,
|
|||
return func
|
||||
|
||||
|
||||
elinks, git_blame = None, None # For linters.
|
||||
elinks, git_diff, git_blame = None, None, None # For linters.
|
||||
with importlib.resources.open_text(eris, "tools.toml") as tools_toml_file:
|
||||
tools_toml = toml.load(tools_toml_file)
|
||||
tools_for_extensions = tools_toml["tools_for_extensions"]
|
||||
|
|
@ -685,6 +685,7 @@ def _tools_for_extension():
|
|||
|
||||
def tools_all():
|
||||
tools_ = set(generic_tools())
|
||||
tools_.add(git_diff)
|
||||
tools_.add(git_blame)
|
||||
tools_.add(git_log)
|
||||
for tool_list in _tools_for_extension().values():
|
||||
|
|
@ -727,7 +728,7 @@ def is_tool_available(tool):
|
|||
|
||||
|
||||
def tools_for_path(path):
|
||||
git_tools = [git_blame, git_log] if os.path.exists(".git") else []
|
||||
git_tools = [git_diff, git_blame, git_log] if os.path.exists(".git") else []
|
||||
root, ext = splitext(path)
|
||||
extra_tools = [] if ext == "" else _tools_for_extension().get(ext[1:], [])
|
||||
tools = generic_tools() + git_tools + extra_tools
|
||||
|
|
|
|||
|
|
@ -111,6 +111,14 @@ tools_for_extensions = [
|
|||
error_status = "not_applicable"
|
||||
has_color = true
|
||||
|
||||
[git_diff]
|
||||
dependencies = ["git"]
|
||||
url = "https://git-scm.com/docs/git-diff"
|
||||
command = "git diff --word-diff=color --exit-code"
|
||||
success_status = "normal"
|
||||
error_status = "problem"
|
||||
has_color = true
|
||||
|
||||
[git_blame]
|
||||
dependencies = ["git"]
|
||||
url = "https://git-scm.com/docs/git-blame"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import eris.tools as tools
|
|||
|
||||
def main():
|
||||
all_tools = ([(["*"], tools.generic_tools() +
|
||||
[tools.git_blame, tools.git_log])] +
|
||||
[tools.git_diff, tools.git_blame, tools.git_log])] +
|
||||
tools.TOOLS_FOR_EXTENSIONS)
|
||||
tool_set = set()
|
||||
extension_set = set()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue