This commit is contained in:
eric
2025-08-28 13:06:53 +08:00
parent 620ba326a9
commit 1b98ac6e72
350 changed files with 154034 additions and 0 deletions

25
runner/parser.go Normal file
View File

@@ -0,0 +1,25 @@
package runner
import (
"github.com/filebrowser/filebrowser/v2/settings"
)
// ParseCommand parses the command taking in account if the current
// instance uses a shell to run the commands or just calls the binary
// directly.
func ParseCommand(s *settings.Settings, raw string) (command []string, name string, err error) {
name, args, err := SplitCommandAndArgs(raw)
if err != nil {
return
}
if len(s.Shell) == 0 || s.Shell[0] == "" {
command = append(command, name)
command = append(command, args...)
} else {
command = append(command, s.Shell...)
command = append(command, raw)
}
return command, name, nil
}