import json from whitebox_tools import WhiteboxTools _underscorer1 = re.compile(r'(.)([A-Z][a-z]+)') _underscorer2 = re.compile('([a-z0-9])([A-Z])') def camel_to_snake(s): subbed = _underscorer1.sub(r'\1_\2', s) return _underscorer2.sub(r'\1_\2', subbed).lower() wbt = WhiteboxTools() # Set the directory containing the whitebox_tools.exe file wbt.exe_path = r'/Users/johnlindsay/Documents/programming/Whitebox/trunk/whitebox_tools/target/release/' toolboxes = wbt.toolbox('') tb_set = set() for tb in toolboxes.split('\n'): if tb.strip(): tb_set.add(tb.strip().split(':')[1].strip()) tb_dict = {} for tb in sorted(tb_set): tb_dict[tb] = [] tools = wbt.list_tools() for t in tools.split("\n"): if t.strip() and "Available Tools" not in t: tool = t.strip().split(":")[0]
import json from whitebox_tools import WhiteboxTools _underscorer1 = re.compile(r'(.)([A-Z][a-z]+)') _underscorer2 = re.compile('([a-z0-9])([A-Z])') def camel_to_snake(s): subbed = _underscorer1.sub(r'\1_\2', s) return _underscorer2.sub(r'\1_\2', subbed).lower() wbt = WhiteboxTools() # Set the directory containing the whitebox_tools.exe file wbt.exe_path = path.dirname(path.abspath(__file__)) + \ r'/target/release/' # wbt.exe_path = r'/Users/johnlindsay/Documents/programming/Whitebox/trunk/whitebox_tools/target/release/' toolboxes = wbt.toolbox('') tb_set = set() for tb in toolboxes.split('\n'): if tb.strip(): tb_set.add(tb.strip().split(':')[1].strip()) tb_dict = {} for tb in sorted(tb_set): tb_dict[tb] = [] tools = wbt.list_tools() for t in tools.split("\n"): if t.strip() and "Available Tools" not in t:
"").replace("{", "").replace("\n", "").strip() helpstring = "" for l in docs: l = l.replace("# See Also", "*See Also*:\n").replace( "# Reference", "*Reference*:\n") helpstring += l + "\n" tool_help_dict[camel_to_snake(toolname)] = helpstring wbt = WhiteboxTools() # Get the root directory containing the WhiteboxTools repo root_dir = path.dirname(path.dirname(path.abspath(__file__))) # Set the directory containing the whitebox_tools.exe file wbt.exe_path = path.join(root_dir, "target/release/") # wbt.exe_path = r'/Users/johnlindsay/Documents/programming/whitebox_tools/whitebox-tools/target/release/' # wbt.ext_path = r'../target/release/' toolboxes = wbt.toolbox('') # print(toolboxes) tb_set = set() for tb in toolboxes.split('\n'): if tb.strip(): tb_set.add(tb.strip().split(':')[1].strip()) tb_dict = {} for tb in sorted(tb_set): tb_dict[tb] = [] tools = wbt.list_tools()