aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-10-12 23:00:18 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-10-12 23:00:18 +0000
commitbdc772022766e65fa8ea6d29fff0735529ab47f3 (patch)
treed12a08d6a29d929fb646571e65bbd68bf009f3d4 /src/libutil/args.hh
parent6c7b81047f8ead0bb2f8dd588dfcb5f50d1554a9 (diff)
parent20d2140e450b066a521933dd322d089fd6c248fa (diff)
Merge branch 'master' of github.com:NixOS/nix into trustless-remote-builder-simple
Diffstat (limited to 'src/libutil/args.hh')
-rw-r--r--src/libutil/args.hh14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libutil/args.hh b/src/libutil/args.hh
index 3c1f87f7e..26f1bc11b 100644
--- a/src/libutil/args.hh
+++ b/src/libutil/args.hh
@@ -192,7 +192,7 @@ public:
{
expectArgs({
.label = label,
- .optional = true,
+ .optional = optional,
.handler = {dest}
});
}
@@ -283,7 +283,17 @@ typedef std::vector<std::pair<std::string, std::string>> Table2;
void printTable(std::ostream & out, const Table2 & table);
-extern std::shared_ptr<std::set<std::string>> completions;
+struct Completion {
+ std::string completion;
+ std::string description;
+
+ bool operator<(const Completion & other) const;
+};
+class Completions : public std::set<Completion> {
+public:
+ void add(std::string completion, std::string description = "");
+};
+extern std::shared_ptr<Completions> completions;
extern bool pathCompletions;
std::optional<std::string> needsCompletion(std::string_view s);