view irccdctl/main.cpp @ 346:a6c3d73d9641

Irccd: unify commands
author David Demelier <markand@malikania.fr>
date Sun, 13 Nov 2016 10:00:20 +0100
parents 006452e4a997
children 24b1709093e7
line wrap: on
line source

/*
 * main.cpp -- irccd controller main
 *
 * 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 "client.hpp"
#include "irccdctl.hpp"
#include "cli.hpp"

using namespace irccd;

int main(int, char **)
{
    try {
        Irccdctl ctl(std::make_unique<Client>());
        ctl.client().connect(net::local::create("/tmp/irccd.sock"));

        cli::PluginConfigCli command;
        command.exec(ctl, {"ask", "disable_if", "ok"});
    } catch (const std::exception &ex) {
        std::cerr << ex.what() << std::endl;
    }
}