Improve windows shell handling (#1309)

* Improve windows shell handling

* Add shell in command line

* Fix shellopts bug

* Add quote string

* Refactor `exportFiles` function

* Add defaults for Windows

* Revert "Add defaults for Windows"

Accidental commit

This reverts commit 5ff32650fe.

* Separate handling for CMD vs PowerShell

* Add case insensitive check
This commit is contained in:
Joe Lim authored and GitHub committed 2023-07-03 17:31:45 +03:00
1 parent 56ab5ccc61
commit 592e7fe4be
4 files changed
+35 -39

No files matched your search

+15 -3
View File
@@ -655,12 +655,24 @@ func (nav *nav) exportFiles() {
var currFile string
if curr, err := nav.currFile(); err == nil {
currFile = curr.path
currFile = quoteString(curr.path)
}
currSelections := nav.currSelections()
var selections []string
for _, selection := range nav.currSelections() {
selections = append(selections, quoteString(selection))
}
currSelections := strings.Join(selections, gOpts.filesep)
exportFiles(currFile, currSelections, nav.currDir().path)
os.Setenv("f", currFile)
os.Setenv("fs", currSelections)
os.Setenv("PWD", quoteString(nav.currDir().path))
if len(selections) == 0 {
os.Setenv("fx", currFile)
} else {
os.Setenv("fx", currSelections)
}
}
func (nav *nav) dirPreviewLoop(ui *ui) {