Implement files query to export files in the current directory as (#1949)

presented in lf (including filter/sorting)

`lf -remote "query $id files"`

This version updates `files` list only before running shell commands.
This commit is contained in:
MahouShoujoMivutilde authored and GitHub committed 2025-04-09 16:37:55 +10:00
1 parent 3fdd991040
commit 1878faa942
5 files changed
+23 -1

No files matched your search

+18
View File
@@ -1224,6 +1224,24 @@ func listMarks(marks map[string]string) string {
return b.String()
}
func listFilesInCurrDir(nav *nav) string {
if !nav.init {
return ""
}
dir := nav.currDir()
if dir.loading {
log.Printf("listFilesInCurrDir(): %s is still loading, `files` isn't ready for remote query", dir.path)
return ""
}
b := new(strings.Builder)
for _, file := range dir.files {
fmt.Fprintln(b, file.path)
}
return b.String()
}
func (ui *ui) pollEvent() tcell.Event {
select {
case val := <-ui.keyChan: