Skip to content

Commit

Permalink
[terminal/input] Fix usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Apr 27, 2024
1 parent 60cb2d9 commit a6468b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ jobs:
name: Typos
runs-on: ubuntu-latest

needs: SendCoverage

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions terminal/input/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func ExampleSetHistoryCapacity() {
func ExampleSetCompletionHandler() {
commands := []string{"add", "delete", "search", "help", "quit"}

input.SetCompletionHandler(func(input string) []string {
SetCompletionHandler(func(input string) []string {
var result []string

for _, c := range commands {
Expand All @@ -131,7 +131,7 @@ func ExampleSetCompletionHandler() {
return result
})

input.SetHintHandler(func(input string) string {
SetHintHandler(func(input string) string {
for _, c := range commands {
if strings.HasPrefix(c, input) {
return c[len(input):]
Expand All @@ -141,7 +141,7 @@ func ExampleSetCompletionHandler() {
return ""
})

input, err := input.Read("Please enter command", true)
input, err := Read("Please enter command", true)

if err != nil {
fmt.Printf("Error: %v\n", err)
Expand All @@ -154,7 +154,7 @@ func ExampleSetCompletionHandler() {
func ExampleSetHintHandler() {
commands := []string{"add", "delete", "search", "help", "quit"}

input.SetCompletionHandler(func(input string) []string {
SetCompletionHandler(func(input string) []string {
var result []string

for _, c := range commands {
Expand All @@ -166,7 +166,7 @@ func ExampleSetHintHandler() {
return result
})

input.SetHintHandler(func(input string) string {
SetHintHandler(func(input string) string {
for _, c := range commands {
if strings.HasPrefix(c, input) {
return c[len(input):]
Expand All @@ -176,7 +176,7 @@ func ExampleSetHintHandler() {
return ""
})

input, err := input.Read("Please enter command", true)
input, err := Read("Please enter command", true)

if err != nil {
fmt.Printf("Error: %v\n", err)
Expand Down

0 comments on commit a6468b9

Please sign in to comment.