Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 6, 2024
1 parent a681621 commit 6f48b48
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/condition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,22 @@ func Executable(s ...string) func(c carapace.Context) bool {
}
}

func Path(c carapace.Context) bool {
if PathPrefix(c) || strings.ContainsAny(c.Value, "\\/") {
return true
func File(s string) func(c carapace.Context) bool {
return func(c carapace.Context) bool {
if _, err := os.Stat(s); err == nil {
return true
}
return false
}
if _, err := os.Stat(c.Value); err == nil {
}

func CompletingPath(c carapace.Context) bool {
if CompletingPathPrefix(c) || strings.ContainsAny(c.Value, "\\/") {
return true
}
return false
return File(c.Value)(c)
}

func PathPrefix(c carapace.Context) bool {
func CompletingPathPrefix(c carapace.Context) bool {
return util.HasPathPrefix(c.Value)
}

0 comments on commit 6f48b48

Please sign in to comment.