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:
1 parent
3fdd991040
commit
1878faa942
5 files changed
+23
-1
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user