From 17246f6f69695da2a02d2b2d15989182d765eb5f Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 3 Jul 2019 18:58:22 +0200 Subject: [PATCH] Lies, lies & damn lies --- confutils.nim | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/confutils.nim b/confutils.nim index 6082122..494d477 100644 --- a/confutils.nim +++ b/confutils.nim @@ -260,9 +260,7 @@ proc completeCmdArg(T: type string, val: TaintedString): seq[string] = proc completeCmdArg*(T: type[InputFile|InputDir], val: TaintedString): seq[string] = let (dir, name, ext) = splitFile(val) let tail = name & ext - # Expand the directory component for the directory walker routine, we still - # gotta use the user-supplied `dir` as a prefix in order to let the shell - # recognize the entry + # Expand the directory component for the directory walker routine let dir_path = if dir == "": "." else: expandTilde(dir) # Dotfiles are hidden unless the user entered a dot as prefix let show_dotfiles = len(name) > 0 and name[0] == '.' @@ -277,9 +275,9 @@ proc completeCmdArg*(T: type[InputFile|InputDir], val: TaintedString): seq[strin if path.startsWith(tail): if type(T) is InputDir: # Add a trailing slash so that completions can be chained - result.add(dir / path & '/') + result.add(dir_path / path & '/') else: - result.add(dir / path) + result.add(dir_path / path) proc completeCmdArg*(T: type[OutFile|OutDir|OutPath], val: TaintedString): seq[string] = return @[]