1.1 --- a/c++/parameter-lister/CLI.cpp Sun May 03 14:24:37 2015 +0200
1.2 +++ b/c++/parameter-lister/CLI.cpp Sun May 03 14:41:28 2015 +0200
1.3 @@ -1,17 +1,48 @@
1.4 #include <cstdlib>
1.5 #include <iostream>
1.6 +#include <vector>
1.7 +#include <algorithm>
1.8 +
1.9 #include "info/globalcode/terminalCodes/TerminalCodes.h"
1.10
1.11 using namespace std;
1.12 -using namespace info::globalCode::parameterLister;
1.13 +using namespace info::globalcode::parameterLister;
1.14
1.15 -int main(int argc, char** argv) {
1.16 -
1.17 +int main(int argc, char* argv[]) {
1.18 terminalCodes::Modifier fgGreen(terminalCodes::FG_GREEN);
1.19 terminalCodes::Modifier fgReset(terminalCodes::FG_DEFAULT);
1.20 +
1.21 + cout << "INFO: " << fgGreen << "Parameter lister" << fgReset << " is starting" << endl;
1.22
1.23 - cout << "INFO: " << fgGreen << "Parameter lister" << fgReset << " is starting" << endl;
1.24 + string command = argv[0];
1.25 + vector<string> args;
1.26 +
1.27 + for (int i = 1; i < argc; i++) {
1.28 + args.push_back(argv[i]);
1.29 + }
1.30 +
1.31 + for_each(args.begin(), args.end(), [command, fgGreen, fgReset](string s) {
1.32 + cout << fgGreen << command << fgReset << ": " << s << endl;
1.33 + });
1.34 +
1.35 +
1.36 +
1.37
1.38 return 0;
1.39 }
1.40
1.41 +
1.42 +
1.43 +namespace info {
1.44 +namespace globalcode {
1.45 +namespace parameterLister {
1.46 +
1.47 +
1.48 +
1.49 +
1.50 +
1.51 +}
1.52 +}
1.53 +}
1.54 +
1.55 +
2.1 --- a/c++/parameter-lister/info/globalcode/terminalCodes/TerminalCodes.h Sun May 03 14:24:37 2015 +0200
2.2 +++ b/c++/parameter-lister/info/globalcode/terminalCodes/TerminalCodes.h Sun May 03 14:41:28 2015 +0200
2.3 @@ -2,37 +2,39 @@
2.4 #define COLORZ_H
2.5
2.6 #include <ostream>
2.7 +
2.8 namespace info {
2.9 - namespace globalCode {
2.10 - namespace parameterLister {
2.11 - namespace terminalCodes {
2.12 +namespace globalcode {
2.13 +namespace parameterLister {
2.14 +namespace terminalCodes {
2.15
2.16 - enum Code {
2.17 - FG_RED = 31,
2.18 - FG_GREEN = 32,
2.19 - FG_BLUE = 34,
2.20 - FG_DEFAULT = 39,
2.21 - BG_RED = 41,
2.22 - BG_GREEN = 42,
2.23 - BG_BLUE = 44,
2.24 - BG_DEFAULT = 49
2.25 - };
2.26 +enum Code {
2.27 + FG_RED = 31,
2.28 + FG_GREEN = 32,
2.29 + FG_BLUE = 34,
2.30 + FG_DEFAULT = 39,
2.31 + BG_RED = 41,
2.32 + BG_GREEN = 42,
2.33 + BG_BLUE = 44,
2.34 + BG_DEFAULT = 49
2.35 +};
2.36
2.37 - class Modifier {
2.38 - Code code;
2.39 - public:
2.40 +class Modifier {
2.41 + Code code;
2.42 +public:
2.43
2.44 - Modifier(Code code) : code(code) {
2.45 - }
2.46 + Modifier(Code code) : code(code) {
2.47 + }
2.48
2.49 - friend std::ostream&
2.50 - operator<<(std::ostream& os, const Modifier& mod) {
2.51 - return os << "\033[" << mod.code << "m";
2.52 - }
2.53 - };
2.54 - }
2.55 - }
2.56 + friend std::ostream&
2.57 + operator<<(std::ostream& os, const Modifier& mod) {
2.58 + return os << "\033[" << mod.code << "m";
2.59 }
2.60 +};
2.61 +
2.62 +}
2.63 +}
2.64 +}
2.65 }
2.66
2.67 #endif /* COLORZ_H */