Configure line endings (windows).

This commit is contained in:
Nuno Cruces 2021-05-07 13:41:48 +01:00
parent 40c8a6e6cd
commit e03bf87915
4 changed files with 8 additions and 15 deletions

View file

@ -82,6 +82,7 @@ var (
noCancel bool
// Windows specific options
unixeol bool
cygpath bool
wslpath bool
)
@ -100,6 +101,9 @@ func main() {
validateFlags()
opts := loadFlags()
zenutil.Command = true
if unixeol {
zenutil.LineBreak = "\n"
}
if zenutil.Timeout > 0 {
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(zenutil.Timeout)*time.Second)
opts = append(opts, zenity.Context(ctx))
@ -218,6 +222,7 @@ func setupFlags() {
// Windows specific options
if runtime.GOOS == "windows" {
flag.BoolVar(&unixeol, "unixeol", false, "Use Unix line endings (Windows only)")
flag.BoolVar(&cygpath, "cygpath", false, "Use cygpath for path translation (Windows only)")
flag.BoolVar(&wslpath, "wslpath", false, "Use wslpath for path translation (Windows only)")
}

View file

@ -1,13 +1,9 @@
package zenutil
// These are internal.
const (
LineBreak = "\n"
)
// These are internal.
var (
Command bool
Timeout int
LineBreak = "\n"
Separator = "\x00"
)

View file

@ -3,14 +3,10 @@
// Package zenutil is internal. DO NOT USE.
package zenutil
// These are internal.
const (
LineBreak = "\n"
)
// These are internal.
var (
Command bool
Timeout int
LineBreak = "\n"
Separator = "\x1e"
)

View file

@ -1,13 +1,9 @@
package zenutil
// These are internal.
const (
LineBreak = "\r\n"
)
// These are internal.
var (
Command bool
Timeout int
Separator string
LineBreak = "\r\n"
)