-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 75a641f
Showing
3 changed files
with
73 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,10 @@ | ||
module github.com/silthus/promptui-git-bash-bug | ||
|
||
go 1.19 | ||
|
||
require github.com/manifoldco/promptui v0.9.0 | ||
|
||
require ( | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect | ||
) |
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 @@ | ||
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= | ||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | ||
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= | ||
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b h1:MQE+LT/ABUuuvEZ+YQAMSXindAdUh7slEmAkup74op4= | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
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,53 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/manifoldco/promptui" | ||
"os" | ||
) | ||
|
||
func main() { | ||
args := os.Args | ||
if len(args) < 2 { | ||
fmt.Println("Please run with one of the types: select, prompt, confirm") | ||
return | ||
} | ||
|
||
switch args[1] { | ||
case "select": | ||
runSelect() | ||
case "prompt": | ||
runPrompt() | ||
case "confirm": | ||
runConfirm() | ||
} | ||
} | ||
|
||
func runSelect() { | ||
s := &promptui.Select{ | ||
Items: []string{"One", "Two", "Three"}, | ||
} | ||
i, result, err := s.Run() | ||
fmt.Println("Error:", err) | ||
fmt.Println("Result:", result) | ||
fmt.Println("Index:", i) | ||
} | ||
|
||
func runPrompt() { | ||
p := &promptui.Prompt{ | ||
Label: "Prompt", | ||
} | ||
result, err := p.Run() | ||
fmt.Println("Error:", err) | ||
fmt.Println("Result:", result) | ||
} | ||
|
||
func runConfirm() { | ||
p := &promptui.Prompt{ | ||
Label: "Confirm", | ||
IsConfirm: true, | ||
} | ||
result, err := p.Run() | ||
fmt.Println("Error:", err) | ||
fmt.Println("Result:", result) | ||
} |