zenity/pwd_darwin.go

35 lines
750 B
Go
Raw Permalink Normal View History

2022-05-11 12:49:15 -04:00
package zenity
import (
"os"
"github.com/ncruces/zenity/internal/zenutil"
)
func password(opts options) (string, string, error) {
if !opts.username {
2022-05-13 12:32:23 -04:00
opts.entryText = ""
2022-05-11 12:49:15 -04:00
opts.hideText = true
str, err := entry("Password:", opts)
return "", str, err
}
var data zenutil.Password
data.Separator = zenutil.Separator
data.Options.Title = opts.title
data.Options.Timeout = zenutil.Timeout
if opts.customIcon != "" {
_, err := os.Stat(opts.customIcon)
if err != nil {
return "", "", err
}
data.IconPath = opts.customIcon
} else {
data.Options.Icon = opts.icon.String()
}
data.SetButtons(getButtons(true, true, opts))
out, err := zenutil.Run(opts.ctx, "pwd", data)
return pwdResult(zenutil.Separator, opts, out, err)
}