MCPcopy Index your code
hub / github.com/dbcli/mycli / parse_path

Function parse_path

mycli/packages/filepaths.py:53–66  ·  view source on GitHub ↗

Split path into head and last component for the completer. Also return position where last component starts. :param root_dir: str path :return: tuple of (string, string, int)

(root_dir: str)

Source from the content-addressed store, hash-verified

51
52
53def parse_path(root_dir: str) -> tuple[str, str, int]:
54 """Split path into head and last component for the completer.
55
56 Also return position where last component starts.
57
58 :param root_dir: str path
59 :return: tuple of (string, string, int)
60
61 """
62 base_dir, last_dir, position = "", "", 0
63 if root_dir:
64 base_dir, last_dir = os.path.split(root_dir)
65 position = -len(last_dir) if last_dir else 0
66 return base_dir, last_dir, position
67
68
69def suggest_path(root_dir: str) -> list[str]:

Callers 1

find_filesMethod · 0.90

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected