zenity/pwd_darwin.go

34 lines
728 B
Go
Raw 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 {
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)
}