# HG changeset patch # User David Demelier # Date 1477990867 -3600 # Node ID f23d71fa2b40f79356e4bcec5ad5995277285d7c # Parent 2ea95292fa775516902e1f602c0e110cb57be6dd Irccdctl: bring back plugin-list diff -r 2ea95292fa77 -r f23d71fa2b40 irccdctl/cli-plugin-list.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-plugin-list.cpp Tue Nov 01 10:01:07 2016 +0100 @@ -0,0 +1,48 @@ +/* + * cli-plugin-list.cpp -- implementation of irccdctl plugin-list + * + * 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 + +#include "cli-plugin-list.hpp" + +namespace irccd { + +namespace cli { + +PluginListCli::PluginListCli() + : Cli("plugin-list", + "list loaded plugins", + "plugin-list", + "Get the list of all loaded plugins.\n\n" + "Example:\n" + "\tirccdctl plugin-list") +{ +} + +void PluginListCli::exec(Irccdctl &irccdctl, const std::vector &) +{ + auto result = request(irccdctl); + + for (const auto &value : result["list"]) + if (value.is_string()) + std::cout << value.get() << std::endl; +} + +} // !cli + +} // !irccd diff -r 2ea95292fa77 -r f23d71fa2b40 irccdctl/cli-plugin-list.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irccdctl/cli-plugin-list.hpp Tue Nov 01 10:01:07 2016 +0100 @@ -0,0 +1,53 @@ +/* + * cli-plugin-list.hpp -- implementation of irccdctl plugin-list + * + * 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_LIST_HPP +#define IRCCDCTL_CLI_PLUGIN_LIST_HPP + +/** + * \file cli-plugin-list.hpp + * \brief Implementation of irccdctl plugin-list. + */ + +#include "cli.hpp" + +namespace irccd { + +namespace cli { + +/** + * \brief Implementation of irccdctl plugin-list. + */ +class PluginListCli : public Cli { +public: + /** + * Default constructor. + */ + PluginListCli(); + + /** + * \copydoc Cli::exec + */ + void exec(Irccdctl &irccdctl, const std::vector &args) override; +}; + +} // !cli + +} // !irccd + +#endif // !IRCCDCTL_CLI_PLUGIN_LIST_HPP