-
-
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.
- Loading branch information
1 parent
fe5a80d
commit 9d14585
Showing
2 changed files
with
40 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)) | ||
} |