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

Function list_path

mycli/packages/filepaths.py:12–31  ·  view source on GitHub ↗

List directory if exists. :param root_dir: str :return: list

(root_dir: str)

Source from the content-addressed store, hash-verified

10
11
12def list_path(root_dir: str) -> list[str]:
13 """List directory if exists.
14
15 :param root_dir: str
16 :return: list
17
18 """
19 files = []
20 dirs = []
21 if not os.path.isdir(root_dir):
22 return []
23 for name in sorted(os.listdir(root_dir)):
24 if name.startswith('.'):
25 continue
26 elif os.path.isdir(name):
27 dirs.append(f'{name}/')
28 # if .sql is too restrictive it can be made configurable with some effort
29 elif name.lower().endswith('.sql'):
30 files.append(name)
31 return files + dirs
32
33
34def complete_path(curr_dir: str, last_dir: str) -> str:

Callers 1

suggest_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected