diff --git a/eris/__main__.py b/eris/__main__.py index ff9cbd5..033d777 100755 --- a/eris/__main__.py +++ b/eris/__main__.py @@ -1115,17 +1115,28 @@ def print_tool_info(): for extension in extensions: for tool in tools_: extensions_for_tool.setdefault(tool, {extension}).add(extension) + pager_process = None + if shutil.which("less"): + pager_process = subprocess.Popen(["less", "-RFEX"], + stdin=subprocess.PIPE, text=True) + output_file = pager_process.stdin + else: + output_file = sys.stdout for tool in sorted(tools.tools_all(), key=lambda t: t.__name__): print(termstr.TermStr(tool.__name__, is_bold=True) if tools.is_tool_available(tool) - else termstr.TermStr(tool.__name__, fg_color=termstr.Color.red) + " (not available)") + else termstr.TermStr(tool.__name__, fg_color=termstr.Color.red) + " (not available)" + , file=output_file) if hasattr(tool, "command"): - print(f"command: {tool.command} foo.{extensions[0]}") + print(f"command: {tool.command} foo.{extensions[0]}", file=output_file) else: - print("function:", "eris.tools." + tool.__name__) - print("url:", tool.url) + print("function:", "eris.tools." + tool.__name__, file=output_file) + print("url:", tool.url, file=output_file) extensions = list(extensions_for_tool.get(tool, {"*"})) - print("extensions:", ", ".join(extensions)) - print() + print("extensions:", ", ".join(extensions), file=output_file) + print("", file=output_file) + if pager_process is not None: + output_file.close() + pager_process.wait() def install_all_tools():