From 4825b37df59583e30e05878ffc60b586e4c7e3c7 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 25 May 2008 01:01:24 -0400 Subject: [PATCH] - Added color command. --- ChangeLog | 9 +++--- TUTORIAL | 7 +++++ configure.ac | 2 +- src/parse.cpp | 1 + src/task.cpp | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/task.h | 1 + 6 files changed, 97 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 458a96bfe..65ea4ca7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,18 @@ -1.0.0 - First official release () +1.0.0 (?) - Bug: assertion fails on mobile for t v -0.9.9 +0.9.9 (?) - Documentation complete -0.9.8 +0.9.8 (?) - Autoconf/autmake behaving properly. - All bugs fixed + + Color command ------ reality ----------------------------------- -0.9.7 (5/19/2008) +0.9.7 (5/24/2008) + Migrated old compiler flags into Makefile.am + Added ncurses endwin function check to configure.ac + Set up structure for AUTHORS file. diff --git a/TUTORIAL b/TUTORIAL index 5d772e03e..d82e3c4d0 100644 --- a/TUTORIAL +++ b/TUTORIAL @@ -487,6 +487,13 @@ with no arguments will generate a help message that lists all these commands. +% task colors +------------- + + This command displays all the colors that task supports. + + + % task usage ------------ diff --git a/configure.ac b/configure.ac index 43f984a52..eb3a8441b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(task, 0.9.7, bugs@beckingham.net) +AC_INIT(task, 0.9.8, bugs@beckingham.net) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/task.cpp]) AC_CONFIG_HEADER([auto.h]) diff --git a/src/parse.cpp b/src/parse.cpp index b7c0f5bee..4e200bd9c 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -93,6 +93,7 @@ static char* commands[] = "active", "add", "calendar", + "colors", "completed", "delete", "done", diff --git a/src/task.cpp b/src/task.cpp index e8f1e4141..10aa198d4 100644 --- a/src/task.cpp +++ b/src/task.cpp @@ -143,6 +143,10 @@ void usage (Config& conf) table.addCell (row, 1, "task export"); table.addCell (row, 2, "Exports all tasks as a CSV file"); + row = table.addRow (); + table.addCell (row, 1, "task color"); + table.addCell (row, 2, "Displays all possible colors"); + row = table.addRow (); table.addCell (row, 1, "task version"); table.addCell (row, 2, "Shows the task version number"); @@ -220,6 +224,7 @@ int main (int argc, char** argv) else if (command == "info") handleInfo (tdb, task, conf); else if (command == "long") handleLongList (tdb, task, conf); else if (command == "ls") handleSmallList (tdb, task, conf); + else if (command == "colors") handleColor ( conf); else if (command == "completed") handleCompleted (tdb, task, conf); else if (command == "delete") handleDelete (tdb, task, conf); else if (command == "start") handleStart (tdb, task, conf); @@ -2477,6 +2482,83 @@ void handleModify (const TDB& tdb, T& task, Config& conf) throw std::string ("Task not found."); } +//////////////////////////////////////////////////////////////////////////////// +void handleColor (Config& conf) +{ + std::cout << std::endl << "Foreground" << std::endl + << " " + << Text::colorize (Text::bold, Text::nocolor, "bold") << " " + << Text::colorize (Text::underline, Text::nocolor, "underline") << " " + << Text::colorize (Text::bold_underline, Text::nocolor, "bold_underline") << std::endl + + << " " << Text::colorize (Text::black, Text::nocolor, "black") << " " + << Text::colorize (Text::bold_black, Text::nocolor, "bold_black") << " " + << Text::colorize (Text::underline_black, Text::nocolor, "underline_black") << " " + << Text::colorize (Text::bold_underline_black, Text::nocolor, "bold_underline_black") << std::endl + + << " " << Text::colorize (Text::red, Text::nocolor, "red") << " " + << Text::colorize (Text::bold_red, Text::nocolor, "bold_red") << " " + << Text::colorize (Text::underline_red, Text::nocolor, "underline_red") << " " + << Text::colorize (Text::bold_underline_red, Text::nocolor, "bold_underline_red") << std::endl + + << " " << Text::colorize (Text::green, Text::nocolor, "green") << " " + << Text::colorize (Text::bold_green, Text::nocolor, "bold_green") << " " + << Text::colorize (Text::underline_green, Text::nocolor, "underline_green") << " " + << Text::colorize (Text::bold_underline_green, Text::nocolor, "bold_underline_green") << std::endl + + << " " << Text::colorize (Text::yellow, Text::nocolor, "yellow") << " " + << Text::colorize (Text::bold_yellow, Text::nocolor, "bold_yellow") << " " + << Text::colorize (Text::underline_yellow, Text::nocolor, "underline_yellow") << " " + << Text::colorize (Text::bold_underline_yellow, Text::nocolor, "bold_underline_yellow") << std::endl + + << " " << Text::colorize (Text::blue, Text::nocolor, "blue") << " " + << Text::colorize (Text::bold_blue, Text::nocolor, "bold_blue") << " " + << Text::colorize (Text::underline_blue, Text::nocolor, "underline_blue") << " " + << Text::colorize (Text::bold_underline_blue, Text::nocolor, "bold_underline_blue") << std::endl + + << " " << Text::colorize (Text::magenta, Text::nocolor, "magenta") << " " + << Text::colorize (Text::bold_magenta, Text::nocolor, "bold_magenta") << " " + << Text::colorize (Text::underline_magenta, Text::nocolor, "underline_magenta") << " " + << Text::colorize (Text::bold_underline_magenta, Text::nocolor, "bold_underline_magenta") << std::endl + + << " " << Text::colorize (Text::cyan, Text::nocolor, "cyan") << " " + << Text::colorize (Text::bold_cyan, Text::nocolor, "bold_cyan") << " " + << Text::colorize (Text::underline_cyan, Text::nocolor, "underline_cyan") << " " + << Text::colorize (Text::bold_underline_cyan, Text::nocolor, "bold_underline_cyan") << std::endl + + << " " << Text::colorize (Text::white, Text::nocolor, "white") << " " + << Text::colorize (Text::bold_white, Text::nocolor, "bold_white") << " " + << Text::colorize (Text::underline_white, Text::nocolor, "underline_white") << " " + << Text::colorize (Text::bold_underline_white, Text::nocolor, "bold_underline_white") << std::endl + + << std::endl << "Background" << std::endl + << " " << Text::colorize (Text::nocolor, Text::on_black, "on_black") << " " + << Text::colorize (Text::nocolor, Text::on_bright_black, "on_bright_black") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_red, "on_red") << " " + << Text::colorize (Text::nocolor, Text::on_bright_red, "on_bright_red") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_green, "on_green") << " " + << Text::colorize (Text::nocolor, Text::on_bright_green, "on_bright_green") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_yellow, "on_yellow") << " " + << Text::colorize (Text::nocolor, Text::on_bright_yellow, "on_bright_yellow") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_blue, "on_blue") << " " + << Text::colorize (Text::nocolor, Text::on_bright_blue, "on_bright_blue") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_magenta, "on_magenta") << " " + << Text::colorize (Text::nocolor, Text::on_bright_magenta, "on_bright_magenta") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_cyan, "on_cyan") << " " + << Text::colorize (Text::nocolor, Text::on_bright_cyan, "on_bright_cyan") << std::endl + + << " " << Text::colorize (Text::nocolor, Text::on_white, "on_white") << " " + << Text::colorize (Text::nocolor, Text::on_bright_white, "on_bright_white") << std::endl + + << std::endl; +} + //////////////////////////////////////////////////////////////////////////////// void gatherNextTasks ( const TDB& tdb, diff --git a/src/task.h b/src/task.h index b756c56da..10ae35e4f 100644 --- a/src/task.h +++ b/src/task.h @@ -47,6 +47,7 @@ void handleDelete (const TDB&, T&, Config&); void handleStart (const TDB&, T&, Config&); void handleDone (const TDB&, T&, Config&); void handleModify (const TDB&, T&, Config&); +void handleColor (Config&); void gatherNextTasks (const TDB&, T&, Config&, std::vector &, std::vector &); void nag (const TDB&, T&, Config&);