Skip to content

Commit

Permalink
Trim away un-needed select menu content (#1712)
Browse files Browse the repository at this point in the history
* Do not scan through .git directories while looking for scripts
(optimization of `find` call only).

* Filter out unwanted lua scripts before returning from shell.

Co-authored-by: Alexander Beels <[email protected]>
  • Loading branch information
beels and Alexander Beels authored Oct 7, 2023
1 parent 06ea9c3 commit 76a053f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lua/core/menu/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ local function sort_select_tree(results)

local t = {}
for filename in results:gmatch("[^\r\n]+") do
if string.match(filename,"/data/")==nil and
string.match(filename,"/lib/")==nil and
string.match(filename,"/crow/")==nil then
table.insert(t,filename)
end
table.insert(t,'/home/we/dust/code/' .. filename)
end

for _,file in pairs(t) do
Expand Down Expand Up @@ -62,7 +58,11 @@ m.init = function()
tabutil.save(m.favorites, paths.favorites)
end
-- weird command, but it is fast, recursive, skips hidden dirs, and sorts
norns.system_cmd('find ~/dust/code/ -name "*.lua" -printf "%P\n"| sort', sort_select_tree)
norns.system_cmd('find ~/dust/code/ -mindepth 2 ' ..
'-name .git -prune -o -type f -name "*.lua" -printf "%P\n" | ' ..
'grep -Ev "/(lib|data|crow)/" | ' ..
'sort',
sort_select_tree)
end

m.deinit = norns.none
Expand Down

0 comments on commit 76a053f

Please sign in to comment.