List paths to all hooks found in dir_path in sorted order. :param str dir_path: directory to search :returns: `list` of `str` :rtype: sorted list of absolute paths to executables in dir_path
(dir_path: str)
| 264 | |
| 265 | |
| 266 | def list_hooks(dir_path: str) -> list[str]: |
| 267 | """List paths to all hooks found in dir_path in sorted order. |
| 268 | |
| 269 | :param str dir_path: directory to search |
| 270 | |
| 271 | :returns: `list` of `str` |
| 272 | :rtype: sorted list of absolute paths to executables in dir_path |
| 273 | |
| 274 | """ |
| 275 | allpaths = (os.path.join(dir_path, f) for f in os.listdir(dir_path)) |
| 276 | hooks = [path for path in allpaths if filesystem.is_executable(path) and not path.endswith('~')] |
| 277 | return sorted(hooks) |
no outgoing calls