aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-08-17 17:44:52 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-08-17 17:44:52 +0200
commita72a20d68fe6ae75f05f69e7de0bc3326d779144 (patch)
treea945dff2d1fbf9a64fa132814a59c4db8020d89e /src/libutil/args.hh
parent7cdc739ece681128dd4153e53acb85867accdd1b (diff)
Add 'nix dump-args' to dump all commands/flags for manpage generation
Diffstat (limited to 'src/libutil/args.hh')
-rw-r--r--src/libutil/args.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/args.hh b/src/libutil/args.hh
index 97a517344..c56044f1d 100644
--- a/src/libutil/args.hh
+++ b/src/libutil/args.hh
@@ -4,6 +4,8 @@
#include <map>
#include <memory>
+#include <nlohmann/json_fwd.hpp>
+
#include "util.hh"
namespace nix {
@@ -203,6 +205,8 @@ public:
});
}
+ virtual nlohmann::json toJSON();
+
friend class MultiCommand;
};
@@ -234,6 +238,8 @@ struct Command : virtual Args
virtual Category category() { return catDefault; }
void printHelp(const string & programName, std::ostream & out) override;
+
+ nlohmann::json toJSON() override;
};
typedef std::map<std::string, std::function<ref<Command>()>> Commands;
@@ -259,6 +265,8 @@ public:
bool processFlag(Strings::iterator & pos, Strings::iterator end) override;
bool processArgs(const Strings & args, bool finish) override;
+
+ nlohmann::json toJSON() override;
};
Strings argvToStrings(int argc, char * * argv);