projj
projj copied to clipboard
find 为什么要优先匹配 endsWith('/{keyword}') ?
比如我有 "abc" 和 "tiny-abc" 两个仓库,"abc" 是常用的关键字,但是 projj find abc
始终只能搜到 "abc"。
const keys = Object.keys(yield this.cache.get());
let matched = keys.filter(key => key.endsWith(repo.replace(/^\/?/, '/')));
if (!matched.length) matched = keys.filter(key => key.indexOf(repo) >= 0);
我觉得搜索结果应该将所有命中的都返回,只是排序上可以有侧重。
@popomore 看看