Skip to content

Commit c1c6d31

Browse files
committed
Small cleanup of fuzzy
1 parent ce491ef commit c1c6d31

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/fuzzy.nim

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import files
55
import std/[os, osproc, parsecfg, streams, strutils]
66

77
proc formatForFuzzy(matches: seq[string]): string =
8-
return matches.join("\n")
8+
matches.join("\n")
99

1010
proc getSelectionFromFuzzy(choices: seq[string], fuzzy: string): string =
1111
var p = startProcess(fuzzy, options = {poUsePath})
@@ -26,19 +26,14 @@ proc hasWarnedAboutNoFuzzy(fuzzy: string): bool =
2626
warn("Try an alternative (fzf or fzy) for this command to work.")
2727
return true
2828

29-
proc selectFromDir*(fromDir: string, config: Config): string =
30-
let choices = getFilesForDir(fromDir)
31-
let fuzzy = getFuzzyProvider(config)
32-
33-
if hasWarnedAboutNoFuzzy(fuzzy):
34-
return
35-
36-
return getSelectionFromFuzzy(choices, fuzzy)
37-
3829
proc selectFromChoice*(choices: seq[string], config: Config): string =
3930
let fuzzy = getFuzzyProvider(config)
4031

4132
if hasWarnedAboutNoFuzzy(fuzzy):
4233
return
4334

4435
return getSelectionFromFuzzy(choices, fuzzy)
36+
37+
proc selectFromDir*(fromDir: string, config: Config): string =
38+
let choices = getFilesForDir(fromDir)
39+
return selectFromChoice(choices, config)

0 commit comments

Comments
 (0)