mirror of
https://github.com/NixOS/nix
synced 2025-07-01 04:18:00 +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
|
@ -24,6 +24,16 @@ class AddCompletions;
|
|||
|
||||
class Args
|
||||
{
|
||||
/**
|
||||
* @brief The command's "working directory", but only set when top level.
|
||||
*
|
||||
* Use getCommandBaseDir() to get the directory regardless of whether this
|
||||
* is a top-level command or subcommand.
|
||||
*
|
||||
* @see getCommandBaseDir()
|
||||
*/
|
||||
Path commandBaseDir = ".";
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
@ -44,6 +54,16 @@ public:
|
|||
*/
|
||||
virtual std::string doc() { return ""; }
|
||||
|
||||
/**
|
||||
* @brief Get the base directory for the command.
|
||||
*
|
||||
* @return Generally the working directory, but in case of a shebang
|
||||
* interpreter, returns the directory of the script.
|
||||
*
|
||||
* This only returns the correct value after parseCmdline() has run.
|
||||
*/
|
||||
Path getCommandBaseDir() const;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue