c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.cpp
author František Kučera <franta-hg@frantovo.cz>
Sun, 11 Sep 2016 19:52:26 +0200
changeset 28 bfef9f34e438
parent 26 6e5c4e267ddb
permissions -rw-r--r--
license: GNU GPL v3
franta-hg@28
     1
/**
franta-hg@28
     2
 * parameter-lister
franta-hg@28
     3
 * Copyright © 2015 František Kučera (frantovo.cz)
franta-hg@28
     4
 *
franta-hg@28
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@28
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@28
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@28
     8
 * (at your option) any later version.
franta-hg@28
     9
 *
franta-hg@28
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@28
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@28
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@28
    13
 * GNU General Public License for more details.
franta-hg@28
    14
 *
franta-hg@28
    15
 * You should have received a copy of the GNU General Public License
franta-hg@28
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@28
    17
 */
franta-hg@18
    18
#include <algorithm>
franta-hg@18
    19
franta-hg@7
    20
#include "TerminalOutputModule.h"
franta-hg@16
    21
#include "terminalCodes/TerminalCodes.h"
franta-hg@7
    22
franta-hg@8
    23
namespace info {
franta-hg@8
    24
namespace globalcode {
franta-hg@8
    25
namespace parameterLister {
franta-hg@8
    26
franta-hg@16
    27
int TerminalOutputModule::process(std::ostream &output, std::string &command, std::vector<std::string> &args) {
franta-hg@11
    28
	using namespace std;
franta-hg@16
    29
	
franta-hg@16
    30
	terminalCodes::Modifier fgGreen(terminalCodes::FG_GREEN);
franta-hg@16
    31
	terminalCodes::Modifier fgReset(terminalCodes::FG_DEFAULT);
franta-hg@16
    32
	
franta-hg@26
    33
	output << fgGreen << "terminalOutputModule >>>" << fgReset << endl;
franta-hg@11
    34
	
franta-hg@20
    35
	for_each(args.begin(), args.end(), [this, &output, command, fgGreen, fgReset](string s) {
franta-hg@26
    36
		output << fgGreen << colorize(RED, command) << fgReset << ": " << escapeValue(s, true) << endl;
franta-hg@18
    37
	});
franta-hg@11
    38
	
franta-hg@26
    39
	output << fgGreen << "<<< terminalOutputModule" << fgReset << endl;
franta-hg@16
    40
	
franta-hg@16
    41
	return 0;
franta-hg@8
    42
}
franta-hg@8
    43
franta-hg@9
    44
}
franta-hg@9
    45
}
franta-hg@9
    46
}
franta-hg@9
    47