forked from lix-project/lix
Move doc() to Args
This commit is contained in:
parent
9fab14adbc
commit
346baec783
|
@ -254,6 +254,8 @@ nlohmann::json Args::toJSON()
|
||||||
res["description"] = description();
|
res["description"] = description();
|
||||||
res["flags"] = std::move(flags);
|
res["flags"] = std::move(flags);
|
||||||
res["args"] = std::move(args);
|
res["args"] = std::move(args);
|
||||||
|
auto s = doc();
|
||||||
|
if (s != "") res.emplace("doc", stripIndentation(s));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,8 +380,6 @@ nlohmann::json Command::toJSON()
|
||||||
|
|
||||||
auto res = Args::toJSON();
|
auto res = Args::toJSON();
|
||||||
res["examples"] = std::move(exs);
|
res["examples"] = std::move(exs);
|
||||||
auto s = doc();
|
|
||||||
if (s != "") res.emplace("doc", stripIndentation(s));
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ public:
|
||||||
/* Return a short one-line description of the command. */
|
/* Return a short one-line description of the command. */
|
||||||
virtual std::string description() { return ""; }
|
virtual std::string description() { return ""; }
|
||||||
|
|
||||||
|
/* Return documentation about this command, in Markdown format. */
|
||||||
|
virtual std::string doc() { return ""; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static const size_t ArityAny = std::numeric_limits<size_t>::max();
|
static const size_t ArityAny = std::numeric_limits<size_t>::max();
|
||||||
|
@ -225,9 +228,6 @@ struct Command : virtual Args
|
||||||
virtual void prepare() { };
|
virtual void prepare() { };
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
|
|
||||||
/* Return documentation about this command, in Markdown format. */
|
|
||||||
virtual std::string doc() { return ""; }
|
|
||||||
|
|
||||||
struct Example
|
struct Example
|
||||||
{
|
{
|
||||||
std::string description;
|
std::string description;
|
||||||
|
|
Loading…
Reference in a new issue