aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Dmenu.cpp
blob: 5c4684182ea89092d0b0e89e03b6a9ad5d984e18 (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&) {
        std::cout << text << std::endl;
        return SearchResult::OK;
    }
}