aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-24 22:12:59 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-24 22:12:59 +0000
commit92d75c7e92c867e1a9d6800e750cb9cabbb5ade5 (patch)
treec1fa5e57d8b57177435e4f7c671292e5689b35ff
parent1e6dd79d2c881ab3e6f41852c8a66362144e07a2 (diff)
downloadpaludis-92d75c7e92c867e1a9d6800e750cb9cabbb5ade5.tar.gz
paludis-92d75c7e92c867e1a9d6800e750cb9cabbb5ade5.tar.xz
Add colour to adjutrix. Add cl_bold_yellow colour name. Remove -C alias for paludis --no-colour.
-rw-r--r--src/adjutrix/Makefile.am4
-rw-r--r--src/adjutrix/adjutrix.cc2
-rw-r--r--src/adjutrix/command_line.cc3
-rw-r--r--src/adjutrix/command_line.hh3
-rw-r--r--src/adjutrix/keywords_graph.cc9
-rw-r--r--src/colour.hh1
-rw-r--r--src/paludis/command_line.cc2
7 files changed, 17 insertions, 7 deletions
diff --git a/src/adjutrix/Makefile.am b/src/adjutrix/Makefile.am
index 95c9727..591b0fd 100644
--- a/src/adjutrix/Makefile.am
+++ b/src/adjutrix/Makefile.am
@@ -1,4 +1,4 @@
-AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
+AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DDATADIR=\"$(datadir)\" \
@@ -23,6 +23,7 @@ man_adjutrix_SOURCES = \
man_adjutrix_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/src/libcolour.a \
$(DYNAMIC_LD_LIBS)
adjutrix_SOURCES = \
@@ -38,6 +39,7 @@ adjutrix_LDADD = \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/src/libcolour.a \
$(DYNAMIC_LD_LIBS)
TESTS_ENVIRONMENT = env \
diff --git a/src/adjutrix/adjutrix.cc b/src/adjutrix/adjutrix.cc
index d335cd0..aade0fa 100644
--- a/src/adjutrix/adjutrix.cc
+++ b/src/adjutrix/adjutrix.cc
@@ -17,6 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "colour.hh"
#include "command_line.hh"
#include "find_stable_candidates.hh"
#include "find_dropped_keywords.hh"
@@ -108,6 +109,7 @@ main(int argc, char *argv[])
try
{
CommandLine::get_instance()->run(argc, argv);
+ set_use_colour(! CommandLine::get_instance()->a_no_color.specified());
if (CommandLine::get_instance()->a_help.specified())
throw DoHelp();
diff --git a/src/adjutrix/command_line.cc b/src/adjutrix/command_line.cc
index 868ca00..6bb4b15 100644
--- a/src/adjutrix/command_line.cc
+++ b/src/adjutrix/command_line.cc
@@ -45,6 +45,9 @@ CommandLine::CommandLine() :
("warning", "Show warnings only")
("silent", "Suppress all log messages"),
"qa"),
+ a_no_colour(&general_args, "no-colour", '\0', "Do not use colour"),
+ a_no_color(&a_no_colour, "no-color"),
+
a_repository_directory(&general_args, "repository-dir", 'D',
"Where to find the repository (default: detected from ./ or ../ or ../..)"),
a_category(&general_args, "category", 'C',
diff --git a/src/adjutrix/command_line.hh b/src/adjutrix/command_line.hh
index 7df9bd2..1be509b 100644
--- a/src/adjutrix/command_line.hh
+++ b/src/adjutrix/command_line.hh
@@ -72,8 +72,9 @@ class CommandLine :
/// General arguments.
paludis::args::ArgsGroup general_args;
- /// --log-level
paludis::args::EnumArg a_log_level;
+ paludis::args::SwitchArg a_no_colour;
+ paludis::args::AliasArg a_no_color;
paludis::args::StringArg a_repository_directory;
paludis::args::StringSetArg a_category;
diff --git a/src/adjutrix/keywords_graph.cc b/src/adjutrix/keywords_graph.cc
index fddc148..e6dffe1 100644
--- a/src/adjutrix/keywords_graph.cc
+++ b/src/adjutrix/keywords_graph.cc
@@ -19,6 +19,7 @@
#include "keywords_graph.hh"
#include "command_line.hh"
+#include "colour.hh"
#include <paludis/util/tokeniser.hh>
#include <paludis/util/compare.hh>
@@ -108,13 +109,13 @@ namespace
a != a_end ; ++a)
{
if (keywords.end() != keywords.find(KeywordName(stringify(*a))))
- cout << "+ ";
+ cout << colour(cl_bold_green, "+ ");
else if (keywords.end() != keywords.find(KeywordName("~" + stringify(*a))))
- cout << "~ ";
+ cout << colour(cl_bold_yellow, "~ ");
else if (keywords.end() != keywords.find(KeywordName("-" + stringify(*a))))
- cout << "- ";
+ cout << colour(cl_red, "- ");
else if (keywords.end() != keywords.find(KeywordName("-*")))
- cout << "* ";
+ cout << colour(cl_red, "* ");
else
cout << " ";
}
diff --git a/src/colour.hh b/src/colour.hh
index a1f5ef1..1e66070 100644
--- a/src/colour.hh
+++ b/src/colour.hh
@@ -35,6 +35,7 @@ enum Colour
cl_bold_red = cl_red + 100,
cl_bold_green = cl_green + 100,
+ cl_bold_yellow = cl_yellow + 100,
cl_bold_blue = cl_blue + 100,
cl_bold_pink = cl_pink + 100,
diff --git a/src/paludis/command_line.cc b/src/paludis/command_line.cc
index 03dccd7..c0caaa2 100644
--- a/src/paludis/command_line.cc
+++ b/src/paludis/command_line.cc
@@ -61,7 +61,7 @@ CommandLine::CommandLine() :
("warning", "Show warnings only")
("silent", "Suppress all log messages"),
"qa"),
- a_no_colour(&general_args, "no-colour", 'C', "Do not use colour"),
+ a_no_colour(&general_args, "no-colour", '\0', "Do not use colour"),
a_no_color(&a_no_colour, "no-color"),
a_config_suffix(&general_args, "config-suffix", 'c', "Config directory suffix"),