# HG changeset patch # User David Demelier # Date 1478001456 -3600 # Node ID df5cc5e6b499ee48a3fcb31b7c1f5e436a805feb # Parent f23d71fa2b40f79356e4bcec5ad5995277285d7c Irccdctl: bring back plugin-load diff -r f23d71fa2b40 -r df5cc5e6b499 irccdctl/cli-plugin-load.cpp --- /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 + * + * 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 &args) +{ + if (args.size() < 1) + throw std::invalid_argument("plugin-load requires 1 argument"); + + check(request(irccdctl, {{"plugin", args[0]}})); +} + +} // !cli + +} // !irccd diff -r f23d71fa2b40 -r df5cc5e6b499 irccdctl/cli-plugin-load.hpp --- /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 + * + * 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 &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_PLUGIN_LOAD_HPP