parent
aebff483a7
commit
ca0068514a
@ -138,6 +138,7 @@ var (
|
||||
"promptfmt",
|
||||
"ratios",
|
||||
"shell",
|
||||
"shellflag",
|
||||
"shellopts",
|
||||
"sortby",
|
||||
"timefmt",
|
||||
|
8
doc.go
8
doc.go
@ -126,6 +126,7 @@ The following options can be used to customize the behavior of lf:
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
@ -641,8 +642,11 @@ A smaller offset can be used when the current file is close to the beginning or
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
|
||||
Shell executable to use for shell commands.
|
||||
Shell commands are executed as 'shell shellopts -c command -- arguments'.
|
||||
On windows, '/c' is used instead of '-c' which should work in 'cmd' and 'powershell'.
|
||||
Shell commands are executed as 'shell shellopts shellflag command -- arguments'.
|
||||
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
|
||||
Command line flag used to pass shell commands.
|
||||
|
||||
shellopts []string (default '')
|
||||
|
||||
|
@ -129,6 +129,7 @@ The following options can be used to customize the behavior of lf:
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
@ -685,8 +686,11 @@ beginning or end of the list to show the maximum number of items.
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
|
||||
Shell executable to use for shell commands. Shell commands are executed as
|
||||
'shell shellopts -c command -- arguments'. On windows, '/c' is used instead
|
||||
of '-c' which should work in 'cmd' and 'powershell'.
|
||||
'shell shellopts shellflag command -- arguments'.
|
||||
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
|
||||
Command line flag used to pass shell commands.
|
||||
|
||||
shellopts []string (default '')
|
||||
|
||||
|
2
eval.go
2
eval.go
@ -309,6 +309,8 @@ func (e *setExpr) eval(app *app, args []string) {
|
||||
app.ui.loadFile(app.nav, true)
|
||||
case "shell":
|
||||
gOpts.shell = e.val
|
||||
case "shellflag":
|
||||
gOpts.shellflag = e.val
|
||||
case "shellopts":
|
||||
if e.val == "" {
|
||||
gOpts.shellopts = nil
|
||||
|
9
lf.1
9
lf.1
@ -141,6 +141,7 @@ The following options can be used to customize the behavior of lf:
|
||||
reverse bool (default off)
|
||||
scrolloff int (default 0)
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
shellopts []string (default '')
|
||||
smartcase bool (default on)
|
||||
smartdia bool (default off)
|
||||
@ -764,7 +765,13 @@ Minimum number of offset lines shown at all times in the top and the bottom of t
|
||||
shell string (default 'sh' for unix and 'cmd' for windows)
|
||||
.EE
|
||||
.PP
|
||||
Shell executable to use for shell commands. Shell commands are executed as 'shell shellopts -c command -- arguments'. On windows, '/c' is used instead of '-c' which should work in 'cmd' and 'powershell'.
|
||||
Shell executable to use for shell commands. Shell commands are executed as 'shell shellopts shellflag command -- arguments'.
|
||||
.PP
|
||||
.EX
|
||||
shellflag string (default '-c' for unix and '/c' for windows)
|
||||
.EE
|
||||
.PP
|
||||
Command line flag used to pass shell commands.
|
||||
.PP
|
||||
.EX
|
||||
shellopts []string (default '')
|
||||
|
2
opts.go
2
opts.go
@ -55,6 +55,7 @@ var gOpts struct {
|
||||
cleaner string
|
||||
promptfmt string
|
||||
shell string
|
||||
shellflag string
|
||||
timefmt string
|
||||
truncatechar string
|
||||
ratios []int
|
||||
@ -95,6 +96,7 @@ func init() {
|
||||
gOpts.cleaner = ""
|
||||
gOpts.promptfmt = "\033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"
|
||||
gOpts.shell = gDefaultShell
|
||||
gOpts.shellflag = gDefaultShellFlag
|
||||
gOpts.timefmt = time.ANSIC
|
||||
gOpts.truncatechar = "~"
|
||||
gOpts.ratios = []int{1, 2, 3}
|
||||
|
3
os.go
3
os.go
@ -23,6 +23,7 @@ var (
|
||||
|
||||
var (
|
||||
gDefaultShell = "sh"
|
||||
gDefaultShellFlag = "-c"
|
||||
gDefaultSocketProt = "unix"
|
||||
gDefaultSocketPath string
|
||||
)
|
||||
@ -99,7 +100,7 @@ func shellCommand(s string, args []string) *exec.Cmd {
|
||||
s = fmt.Sprintf("IFS='%s'; %s", gOpts.ifs, s)
|
||||
}
|
||||
|
||||
args = append([]string{"-c", s, "--"}, args...)
|
||||
args = append([]string{gOpts.shellflag, s, "--"}, args...)
|
||||
|
||||
args = append(gOpts.shellopts, args...)
|
||||
|
||||
|
@ -22,6 +22,7 @@ var envPathExt = os.Getenv("PATHEXT")
|
||||
|
||||
var (
|
||||
gDefaultShell = "cmd"
|
||||
gDefaultShellFlag = "/c"
|
||||
gDefaultSocketProt = "tcp"
|
||||
gDefaultSocketPath = "127.0.0.1:12345"
|
||||
)
|
||||
@ -77,7 +78,7 @@ func detachedCommand(name string, arg ...string) *exec.Cmd {
|
||||
}
|
||||
|
||||
func shellCommand(s string, args []string) *exec.Cmd {
|
||||
args = append([]string{"/c", s}, args...)
|
||||
args = append([]string{gOpts.shellflag, s}, args...)
|
||||
|
||||
args = append(gOpts.shellopts, args...)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user