Mercurial > irccd
changeset 324:bf23ba419ee6
Irccdctl: bring back plugin-unload
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 03 Nov 2016 20:57:38 +0100 |
parents | d178defe9d2a |
children | 3d1f32a2b994 |
files | irccdctl/cli-plugin-unload.cpp irccdctl/cli-plugin-unload.hpp |
diffstat | 2 files changed, 95 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-plugin-unload.cpp Thu Nov 03 20:57:38 2016 +0100 @@ -0,0 +1,45 @@ +/* + * cli-plugin-unload.cpp -- implementation of irccdctl plugin-unload + * + * 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-unload.hpp" + +namespace irccd { + +namespace cli { + +PluginUnloadCli::PluginUnloadCli() + : Cli("plugin-unload", + "unload a plugin", + "plugin-unload plugin", + "Unload a loaded plugin from the irccd instance.\n\n" + "Example:\n" + "tirccdctl plugin-unload logger") +{ +} + +void PluginUnloadCli::exec(Irccdctl &irccdctl, const std::vector<std::string> &args) +{ + if (args.size() < 1) + throw std::invalid_argument("plugin-unload 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-unload.hpp Thu Nov 03 20:57:38 2016 +0100 @@ -0,0 +1,50 @@ +/* + * cli-plugin-unload.hpp -- implementation of irccdctl plugin-unload + * + * 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_UNLOAD_HPP +#define IRCCDCTL_CLI_PLUGIN_UNLOAD_HPP + +/** + * \file cli-plugin-unload.hpp + * \brief Implementation of irccdctl plugin-unload. + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +/** + * \brief Implementation of irccdctl plugin-unload. + */ +class PluginUnloadCli : public Cli { +public: + PluginUnloadCli(); + + /** + * \copydoc Cli::exec + */ + void exec(Irccdctl &irccdctl, const std::vector<std::string> &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_PLUGIN_UNLOAD_HPP