Skip to content

Commit

Permalink
fix: zoxide missing or no results (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmedeski authored Jan 16, 2024
1 parent 9eb04dc commit bb3b83f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zoxide/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ type ZoxideResult struct {
func List(tmuxSessions []*tmux.TmuxSession) ([]*ZoxideResult, error) {
output, err := zoxideCmd([]string{"query", "-ls"})
if err != nil {
return nil, err
return []*ZoxideResult{}, nil
}
cleanOutput := strings.TrimSpace(string(output))
list := strings.Split(cleanOutput, "\n")
listLen := len(list)
if listLen == 1 && list[0] == "" {
return []*ZoxideResult{}, nil
}

results := make([]*ZoxideResult, 0, len(list))
results := make([]*ZoxideResult, 0, listLen)
tmuxSessionPaths := make(map[string]struct{})
for _, session := range tmuxSessions {
tmuxSessionPaths[session.Path] = struct{}{}
Expand Down

0 comments on commit bb3b83f

Please sign in to comment.