hello output::blank_line() (with optional bool) (fixes bug #8 )

This commit is contained in:
Nicholas O'Connor 2017-04-13 14:35:50 -07:00
parent f83b5eb6d4
commit cd71e7f90f
3 changed files with 11 additions and 3 deletions

View File

@ -13,6 +13,8 @@ namespace cellar {
extern void warning(std::string, bool); extern void warning(std::string, bool);
extern void error(std::string, bool); extern void error(std::string, bool);
extern void blank_line(bool verbose = false);
extern bool colors; extern bool colors;
extern void detect_colors(); extern void detect_colors();
} }

View File

@ -17,7 +17,7 @@ void cellar::core::help_command(int argc, vector<string> argv) {
vector<string> commands = list_commands(); vector<string> commands = list_commands();
cellar::print_header(); cellar::print_header();
cout << endl; // TODO: cellar::output function for code clarity output::blank_line();
if (argc == 1) { if (argc == 1) {
output::statement("You have these commands:"); output::statement("You have these commands:");
@ -42,7 +42,7 @@ void cellar::core::help_command(int argc, vector<string> argv) {
else { sstr << desc; } else { sstr << desc; }
output::statement(sstr.str()); output::statement(sstr.str());
cout << endl; output::blank_line();
string details = help::get_details(command); string details = help::get_details(command);
if (details.empty()) { output::statement("no details available."); } if (details.empty()) { output::statement("no details available."); }
@ -52,7 +52,7 @@ void cellar::core::help_command(int argc, vector<string> argv) {
for (string line : detaillines) { for (string line : detaillines) {
if (!line.empty()) { output::statement(line); } if (!line.empty()) { output::statement(line); }
else { cout << endl; } else { output::blank_line(); }
} }
} }
} }

View File

@ -66,3 +66,9 @@ void cellar::output::error(string str_message, bool verbose) {
} }
void cellar::output::error(string str_message) { error(str_message, false); } void cellar::output::error(string str_message) { error(str_message, false); }
void cellar::output::blank_line(bool verbose) {
if (verbose and !cellar::verbose) { return; }
if (colors) { // don't output if not in colors mode, for easier parsing
cout << endl;
}
}