-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
pwd_darwin.go
41 lines (36 loc) · 870 Bytes
/
pwd_darwin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package zenity
import (
"os"
"github.com/ncruces/zenity/internal/zenutil"
)
func password(opts options) (string, string, error) {
if !opts.username {
opts.entryText = ""
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.attach != nil {
data.Application = opts.attach
}
if i, ok := opts.windowIcon.(string); ok {
data.WindowIcon = i
}
switch i := opts.icon.(type) {
case string:
_, err := os.Stat(i)
if err != nil {
return "", "", err
}
data.IconPath = i
case DialogIcon:
data.Options.Icon = i.String()
}
data.SetButtons(getButtons(true, true, opts))
out, err := zenutil.Run(opts.ctx, "pwd", data)
return pwdResult(zenutil.Separator, opts, out, err)
}