(
rawPaths: VaultTextSearchToolPaths = {},
force = false
)
| 1953 | } |
| 1954 | |
| 1955 | export async function searchVaultTextCapabilities( |
| 1956 | rawPaths: VaultTextSearchToolPaths = {}, |
| 1957 | force = false |
| 1958 | ): Promise<VaultTextSearchCapabilities> { |
| 1959 | const paths = normalizeVaultTextSearchToolPaths(rawPaths) |
| 1960 | const key = capabilityCacheKey(paths) |
| 1961 | const now = Date.now() |
| 1962 | if ( |
| 1963 | !force && |
| 1964 | cachedVaultTextSearchCapabilities && |
| 1965 | cachedVaultTextSearchCapabilities.key === key && |
| 1966 | now - cachedVaultTextSearchCapabilities.at < 30_000 |
| 1967 | ) { |
| 1968 | return cachedVaultTextSearchCapabilities.value |
| 1969 | } |
| 1970 | |
| 1971 | const ripgrep = await searchExecutable('ripgrep', paths) |
| 1972 | const fzf = await searchExecutable('fzf', paths) |
| 1973 | const value = { |
| 1974 | ripgrep: ripgrep ? await commandAvailable(ripgrep) : false, |
| 1975 | fzf: fzf ? await commandAvailable(fzf) : false |
| 1976 | } |
| 1977 | cachedVaultTextSearchCapabilities = { at: now, key, value } |
| 1978 | return value |
| 1979 | } |
| 1980 | |
| 1981 | function resolveSearchBackend( |
| 1982 | preferred: VaultTextSearchBackendPreference, |
no test coverage detected