changeset 322:df5cc5e6b499

Irccdctl: bring back plugin-load
author David Demelier <markand@malikania.fr>
date Tue, 01 Nov 2016 12:57:36 +0100
parents f23d71fa2b40
children d178defe9d2a
files irccdctl/cli-plugin-load.cpp irccdctl/cli-plugin-load.hpp
diffstat 2 files changed, 98 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/irccdctl/cli-plugin-load.cpp	Tue Nov 01 12:57:36 2016 +0100
@@ -0,0 +1,45 @@
+/*
+ * cli-plugin-load.cpp -- implementation of irccdctl plugin-load
+ *
+ * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cli-plugin-load.hpp"
+
+namespace irccd {
+
+namespace cli {
+
+PluginLoadCli::PluginLoadCli()
+    : Cli("plugin-load",
+          "load a plugin",
+          "plugin-load logger",
+          "Load a plugin into the irccd instance.\n\n"
+          "Example:\n"
+          "\tirccdctl plugin-load logger")
+{
+}
+
+void PluginLoadCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args)
+{
+    if (args.size() < 1)
+        throw std::invalid_argument("plugin-load requires 1 argument");
+
+    check(request(irccdctl, {{"plugin", args[0]}}));
+}
+
+} // !cli
+
+} // !irccd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/irccdctl/cli-plugin-load.hpp	Tue Nov 01 12:57:36 2016 +0100
@@ -0,0 +1,53 @@
+/*
+ * cli-plugin-load.hpp -- implementation of irccdctl plugin-load
+ *
+ * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef IRCCDCTL_CLI_PLUGIN_LOAD_HPP
+#define IRCCDCTL_CLI_PLUGIN_LOAD_HPP
+
+/**
+ * \file cli-plugin-load.hpp
+ * \brief Implementation of irccdctl plugin-load.
+ */
+
+#include "cli.hpp"
+
+namespace irccd {
+
+namespace cli {
+
+/**
+ * \brief Implementation of irccdctl plugin-load.
+ */
+class PluginLoadCli : public Cli {
+public:
+    /**
+     * Default constructor.
+     */
+    PluginLoadCli();
+
+    /**
+     * \copydoc Cli::exec
+     */
+    void exec(Irccdctl &irccdctl, const std::vector<std::string> &args) override;
+};
+
+} // !cli
+
+} // !irccd
+
+#endif // !IRCCDCTL_CLI_PLUGIN_LOAD_HPP