-
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #458 from MarkusZoppelt/add-feedback-password-prom…
…pter
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"time" | ||
|
||
"atomicgo.dev/keyboard" | ||
"atomicgo.dev/keyboard/keys" | ||
) | ||
|
||
// ------ Automation for CI ------ | ||
// You can ignore this function, it is used to automatically run the demo and generate the example animation in our CI system. | ||
func init() { | ||
if os.Getenv("CI") == "true" { | ||
go func() { | ||
time.Sleep(time.Second) | ||
input := "Hello, World!" | ||
for _, r := range input { | ||
if r == '\n' { | ||
keyboard.SimulateKeyPress(keys.Enter) | ||
} else { | ||
keyboard.SimulateKeyPress(r) | ||
} | ||
time.Sleep(time.Millisecond * 250) | ||
} | ||
|
||
keyboard.SimulateKeyPress(keys.Enter) | ||
}() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package main | ||
|
||
import "github.com/pterm/pterm" | ||
|
||
func main() { | ||
result, _ := pterm.DefaultInteractiveTextInput.WithMask("*").Show("Enter your password") | ||
|
||
logger := pterm.DefaultLogger | ||
logger.Info("Password received", logger.Args("password", result)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters