Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
fix(applescript): Support empty string default (#52)
Browse files Browse the repository at this point in the history
Support empty string defaults for the AppleScript dialog boxes.

This resolves an issue where if the Answer field was set as the empty string, it would no longer show the textbox. This allows a textbox-always handling for empty string answers, to ensure the textbox exists. As we don't leverage the dialog for confirmation windows, this is sufficient to handle out input case.

Confirmed working by testing locally with the AppleScript base cases (push/totp, no username, etc).

Additionally the location of the config file is now using the projectFileName constant.
  • Loading branch information
rtkjbeverly authored Nov 17, 2021
1 parent 971fac9 commit b59ae1a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 60 deletions.
2 changes: 1 addition & 1 deletion config/loadConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (d ConfigLoader) LoadConfigs() UserConfig {
}

func (d ConfigLoader) getUserConfig() string {
userConfig := filepath.ToSlash(path.Join(d.UserDir(), ".bmx", configFileName))
userConfig := filepath.ToSlash(path.Join(d.UserDir(), projectFileName, configFileName))
if _, err := os.Stat(userConfig); err == nil {
return userConfig
}
Expand Down
6 changes: 3 additions & 3 deletions console/AppleScript.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r AppleScriptConsole) ReadLine(prompt string) (string, error) {
dialog := mack.DialogOptions{
Text: prompt,
Title: fmt.Sprintf("BMX Prompt: %s", prompt),
Answer: " ",
Answer: "",
}
response, err := mack.DialogBox(dialog)
if err != nil {
Expand All @@ -71,7 +71,7 @@ func (r AppleScriptConsole) ReadInt(prompt string) (int, error) {
dialog := mack.DialogOptions{
Text: prompt,
Title: fmt.Sprintf("BMX Prompt: %s", prompt),
Answer: " ",
Answer: "",
}
response, err := mack.DialogBox(dialog)
if err != nil {
Expand Down Expand Up @@ -101,7 +101,7 @@ func (r AppleScriptConsole) ReadPassword(prompt string) (string, error) {
Text: prompt,
Title: fmt.Sprintf("BMX Credential Request: %s", prompt),
HiddenAnswer: true,
Answer: "123",
Answer: "",
}
response, err := mack.DialogBox(dialog)
if err != nil {
Expand Down
114 changes: 58 additions & 56 deletions vendor/github.com/andybrewer/mack/dialog.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b59ae1a

Please sign in to comment.