diff options
author | Naïm Favier <n@monade.li> | 2022-02-19 14:26:34 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-03-07 12:01:54 +0100 |
commit | 55c6906701ee7fc7e915f7889fea86957b020f94 (patch) | |
tree | 6cb5da6e1fb9f55ad0197fd28ade86a0c1db31df /src/libcmd | |
parent | 5461ff532d6169be86af703b15cfb49569732cbb (diff) |
Perform tilde expansion when completing flake fragments
Allows completing `nix build ~/flake#<Tab>`.
We can implement expansion for `~user` later if needed.
Not using wordexp(3) since that expands way too much.
Diffstat (limited to 'src/libcmd')
-rw-r--r-- | src/libcmd/installables.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index c4fefb971..a0b8d0af5 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -1,4 +1,5 @@ #include "installables.hh" +#include "util.hh" #include "command.hh" #include "attr-path.hh" #include "common-eval-args.hh" @@ -256,8 +257,7 @@ void completeFlakeRefWithFragment( auto fragment = prefix.substr(hash + 1); auto flakeRefS = std::string(prefix.substr(0, hash)); - // FIXME: do tilde expansion. - auto flakeRef = parseFlakeRef(flakeRefS, absPath(".")); + auto flakeRef = parseFlakeRef(expandTilde(flakeRefS), absPath(".")); auto evalCache = openEvalCache(*evalState, std::make_shared<flake::LockedFlake>(lockFlake(*evalState, flakeRef, lockFlags))); |