mirror of
https://github.com/NixOS/nix
synced 2025-06-28 13:41:15 +02:00
nix: Add command baseDir to parse --expr relative to shebang script
This commit is contained in:
parent
20ff61ab25
commit
198bc22e3b
5 changed files with 51 additions and 1 deletions
|
@ -276,6 +276,7 @@ void Args::parseCmdline(const Strings & _cmdline, bool allowShebang)
|
|||
cmdline.push_back(word);
|
||||
}
|
||||
cmdline.push_back(script);
|
||||
commandBaseDir = dirOf(script);
|
||||
for (auto pos = savedArgs.begin(); pos != savedArgs.end();pos++)
|
||||
cmdline.push_back(*pos);
|
||||
}
|
||||
|
@ -336,6 +337,14 @@ void Args::parseCmdline(const Strings & _cmdline, bool allowShebang)
|
|||
d.completer(*completions, d.n, d.prefix);
|
||||
}
|
||||
|
||||
Path Args::getCommandBaseDir() const
|
||||
{
|
||||
if (parent)
|
||||
return parent->getCommandBaseDir();
|
||||
else
|
||||
return commandBaseDir;
|
||||
}
|
||||
|
||||
bool Args::processFlag(Strings::iterator & pos, Strings::iterator end)
|
||||
{
|
||||
assert(pos != end);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue