aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Dmenu.cpp
blob: a3b354bf70bd6bee49842009916eda195be24d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "../../plugins/Dmenu.hpp"
#include <iostream>

namespace QuickMedia {
    Dmenu::Dmenu() : Plugin("dmenu") {
        std::string line;
        while(std::getline(std::cin, line)) {
            stdin_data.push_back(std::move(line));
        }
    }

    PluginResult Dmenu::get_front_page(BodyItems &result_items) {
        for(const std::string &line_data : stdin_data) {
            result_items.push_back(std::make_unique<BodyItem>(line_data));
        }
        return PluginResult::OK;
    }

    SearchResult Dmenu::search(const std::string &text, BodyItems &result_items) {
        std::cout << text << std::endl;
        return SearchResult::OK;
    }
}