Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
root.hh
1#pragma once
2
3#include "nix/util/args.hh"
4
5namespace nix {
6
14{
15 std::set<Completion> completions;
16 Type type = Type::Normal;
17
18 void setType(Type type) override;
19 void add(std::string completion, std::string description = "") override;
20};
21
30class RootArgs : virtual public Args
31{
32protected:
41 std::filesystem::path commandBaseDir = ".";
42
43public:
47 void parseCmdline(const Strings & cmdline, bool allowShebang = false);
48
49 std::shared_ptr<Completions> completions;
50
51 std::filesystem::path getCommandBaseDir() const override;
52
53protected:
54
55 friend class Args;
56
61 {
62 const CompleterClosure & completer;
63 size_t n;
64 std::string prefix;
65 };
66
71 std::vector<DeferredCompletion> deferredCompletions;
72
79 std::set<ExperimentalFeature> flagExperimentalFeatures;
80
81private:
82
83 std::optional<std::string> needsCompletion(std::string_view s);
84};
85
86} // namespace nix
Definition args.hh:466
Type
Definition args.hh:475
std::function< CompleterFun > CompleterClosure
Definition args.hh:186
Definition root.hh:31
std::filesystem::path commandBaseDir
The command's "working directory", but only set when top level.
Definition root.hh:41
std::vector< DeferredCompletion > deferredCompletions
Definition root.hh:71
void parseCmdline(const Strings &cmdline, bool allowShebang=false)
Definition args.cc:270
std::filesystem::path getCommandBaseDir() const override
Get the base directory for the command.
Definition args.cc:383
std::set< ExperimentalFeature > flagExperimentalFeatures
Definition root.hh:79
Definition root.hh:14
void add(std::string completion, std::string description="") override
Definition args.cc:48
void setType(Type type) override
Definition args.cc:43