Merge "libutil: fix args assert being thrown on Darwin in nix-eval-jobs" into main
This commit is contained in:
commit
a75d7a5777
|
@ -64,7 +64,7 @@ RootArgs & Args::getRoot()
|
||||||
while (p->parent)
|
while (p->parent)
|
||||||
p = p->parent;
|
p = p->parent;
|
||||||
|
|
||||||
auto * res = dynamic_cast<RootArgs *>(p);
|
auto res = p->asRootArgs();
|
||||||
assert(res);
|
assert(res);
|
||||||
return *res;
|
return *res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,6 +244,13 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual void initialFlagsProcessed() {}
|
virtual void initialFlagsProcessed() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this Args as a RootArgs if it is one, or \ref std::nullopt otherwise.
|
||||||
|
*/
|
||||||
|
virtual std::optional<std::reference_wrapper<RootArgs>> asRootArgs() {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void addFlag(Flag && flag);
|
void addFlag(Flag && flag);
|
||||||
|
|
|
@ -65,6 +65,10 @@ protected:
|
||||||
*/
|
*/
|
||||||
std::set<ExperimentalFeature> flagExperimentalFeatures;
|
std::set<ExperimentalFeature> flagExperimentalFeatures;
|
||||||
|
|
||||||
|
virtual std::optional<std::reference_wrapper<RootArgs>> asRootArgs() override {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::optional<std::string> needsCompletion(std::string_view s);
|
std::optional<std::string> needsCompletion(std::string_view s);
|
||||||
|
|
Loading…
Reference in a new issue