Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding interactive continue printer
Signed-off-by: Luis Davim <luis.davim@sendoso.com>
- Loading branch information
Showing
10 changed files
with
525 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
### interactive_continue/demo | ||
|
||
![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/interactive_continue/demo/animation.svg) | ||
|
||
<details> | ||
|
||
<summary>SHOW SOURCE</summary> | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
result, _ := pterm.DefaultInteractiveContinue.Show() | ||
pterm.Println() // Blank line | ||
pterm.Info.Printfln("You answered: %s", result) | ||
} | ||
|
||
``` | ||
|
||
</details> | ||
|
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,18 @@ | ||
# interactive_continue/demo | ||
|
||
![Animation](animation.svg) | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
result, _ := pterm.DefaultInteractiveContinue.Show() | ||
pterm.Println() // Blank line | ||
pterm.Info.Printfln("You answered: %s", result) | ||
} | ||
|
||
``` |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,19 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"time" | ||
|
||
"atomicgo.dev/keyboard" | ||
) | ||
|
||
// ------ 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 * 2) | ||
keyboard.SimulateKeyPress('y') | ||
}() | ||
} | ||
} |
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,11 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/pterm/pterm" | ||
) | ||
|
||
func main() { | ||
result, _ := pterm.DefaultInteractiveContinue.Show() | ||
pterm.Println() // Blank line | ||
pterm.Info.Printfln("You answered: %s", 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
Oops, something went wrong.