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

Function complete_path

mycli/packages/filepaths.py:34–50  ·  view source on GitHub ↗

Return the path to complete that matches the last entered component. If the last entered component is ~, expanded path would not match, so return all of the available paths. :param curr_dir: str :param last_dir: str :return: str

(curr_dir: str, last_dir: str)

Source from the content-addressed store, hash-verified

32
33
34def complete_path(curr_dir: str, last_dir: str) -> str:
35 """Return the path to complete that matches the last entered component.
36
37 If the last entered component is ~, expanded path would not
38 match, so return all of the available paths.
39
40 :param curr_dir: str
41 :param last_dir: str
42 :return: str
43
44 """
45 if not last_dir or curr_dir.startswith(last_dir):
46 return curr_dir
47 elif last_dir == "~":
48 return os.path.join(last_dir, curr_dir)
49 else:
50 return ''
51
52
53def parse_path(root_dir: str) -> tuple[str, str, int]:

Callers 1

find_filesMethod · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected