Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Nov 30, 2023
1 parent 1e21686 commit add1441
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ func (a Action) Filter(values ...string) Action {
})
}

// FilterArgs filters Context.Args
// FilterArgs filters Context.Args.
func (a Action) FilterArgs() Action {
return ActionCallback(func(c Context) Action {
return a.Filter(c.Args...)
})
}

// FilterArgs filters Context.Parts
// FilterArgs filters Context.Parts.
func (a Action) FilterParts() Action {
return ActionCallback(func(c Context) Action {
return a.Filter(c.Parts...)
Expand Down Expand Up @@ -142,7 +142,7 @@ func (a Action) MultiParts(dividers ...string) Action {
})
}

// MultiPartsP is like MultiParts but with placeholders
// MultiPartsP is like MultiParts but with placeholders.
func (a Action) MultiPartsP(delimiter string, pattern string, f func(placeholder string, matches map[string]string) Action) Action {
return ActionCallback(func(c Context) Action {
invoked := a.Invoke(c)
Expand Down
2 changes: 1 addition & 1 deletion compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (d compDirective) ToA(values ...string) Action {
var action Action
switch {
case d.matches(cobra.ShellCompDirectiveError):
return ActionMessage("an error occured")
return ActionMessage("an error occurred")
case d.matches(cobra.ShellCompDirectiveFilterDirs):
switch len(values) {
case 0:
Expand Down
1 change: 0 additions & 1 deletion example/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ func init() {
return carapace.ActionExecute(cmd)
}),
)

}
2 changes: 1 addition & 1 deletion example/cmd/compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestCompat(t *testing.T) {
)

s.Run("compat", "--error", "").
Expect(carapace.ActionMessage("an error occured").
Expect(carapace.ActionMessage("an error occurred").
Usage("ShellCompDirectiveError"))

s.Run("compat", "--nospace", "").
Expand Down
2 changes: 0 additions & 2 deletions example/cmd/modifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func TestCache(t *testing.T) {
s.Run("modifier", "--cache", "").
ExpectNot(cached.
Usage("Cache()"))

})
}

Expand Down Expand Up @@ -239,7 +238,6 @@ func TestFilterParts(t *testing.T) {
NoSpace(',').
Prefix("one,three,").
Usage("FilterParts()"))

})
}

Expand Down
2 changes: 1 addition & 1 deletion example/cmd/multiparts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/rsteube/carapace/pkg/style"
)

// TODO rename
// TODO rename.
func TestMultiparts(t *testing.T) {
sandbox.Package(t, "github.com/rsteube/carapace/example")(func(s *sandbox.Sandbox) {
s.Files(
Expand Down
1 change: 0 additions & 1 deletion example/cmd/special.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ func init() {
carapace.Gen(specialCmd).PositionalCompletion(
carapace.ActionValues(`p1 & < > ' " { } $ # | ? ( ) ; [ ] * \ `+"`", "positional1"),
)

}
2 changes: 1 addition & 1 deletion internal/shell/nushell/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package nushell
import (
"strings"

"github.com/rsteube/carapace-shlex"
shlex "github.com/rsteube/carapace-shlex"
)

// Patch uses the lexer to parse and patch given arguments which
Expand Down
3 changes: 1 addition & 2 deletions storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestCheck(t *testing.T) {
}
}

// BenchmarkStorage tests for concurrent map read/write
// BenchmarkStorage tests for concurrent map read/write.
func BenchmarkStorage(b *testing.B) {
cmd := &cobra.Command{}
cmd2 := &cobra.Command{}
Expand All @@ -98,5 +98,4 @@ func BenchmarkStorage(b *testing.B) {
storage.getPositional(cmd2, 0)
}
})

}

0 comments on commit add1441

Please sign in to comment.