Feature - version command

- Rearranged output of the version command.
- Added build information (OS) and packages (ncurses ...).
This commit is contained in:
Paul Beckingham 2009-12-18 22:31:54 -05:00
parent 2ec5a315cb
commit 2a8acaf351
2 changed files with 51 additions and 12 deletions

View file

@ -24,13 +24,25 @@ else
fi
# Check for OS.
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'|cut -c 1-5`
if test "$OS" = "sunos"; then
AC_MSG_NOTICE([OS Solaris detected])
AC_DEFINE([SOLARIS], [], [Compiling on Solaris])
elif test "$OS" = "darwi"; then
AC_MSG_NOTICE([OS Darwin detected])
AC_DEFINE([DARWIN], [], [Compiling on Darwin])
elif test "$OS" = "cygwi"; then
AC_MSG_NOTICE([OS Cygwin detected])
AC_DEFINE([CYGWIN], [], [Compiling on Cygwin])
elif test "$OS" = "openb"; then
AC_MSG_NOTICE([OS OpenBSD detected])
AC_DEFINE([OPENBSD], [], [Compiling on OpenBSD])
elif test "$OS" = "haiku"; then
AC_MSG_NOTICE([OS Haiku detected])
AC_DEFINE([HAIKU], [], [Compiling on Haiku])
else
AC_MSG_NOTICE([OS Non-Solaris detected])
AC_DEFINE([LINUX], [], [Compiling on Non-Solaris])
AC_MSG_NOTICE([OS Linux detected])
AC_DEFINE([LINUX], [], [Compiling on Linux])
fi
AM_INIT_AUTOMAKE

View file

@ -433,9 +433,8 @@ int handleVersion (std::string &outs)
disclaimer.setColumnWidth (0, Table::flexible);
disclaimer.setColumnJustification (0, Table::left);
disclaimer.addCell (disclaimer.addRow (), 0,
"Task comes with ABSOLUTELY NO WARRANTY; for details read the COPYING file "
"included. This is free software, and you are welcome to redistribute it "
"under certain conditions; again, see the COPYING file for details.");
"Task may be copied only under the terms of the GNU General Public "
"License, which may be found in the task source kit.");
// Create a table for the URL.
Table link;
@ -444,9 +443,8 @@ int handleVersion (std::string &outs)
link.setColumnWidth (0, Table::flexible);
link.setColumnJustification (0, Table::left);
link.addCell (link.addRow (), 0,
"See http://taskwarrior.org for the latest releases, online documentation "
"and lively discussion. New releases containing fixes and enhancements "
"are made frequently. Don't forget the man pages 'man task' and 'man taskrc'.");
"Documentation for task can be found using 'man task' and 'man taskrc', or "
"at http://taskwarrior.org");
std::vector <std::string> all;
context.config.all (all);
@ -488,8 +486,7 @@ int handleVersion (std::string &outs)
Color bold ("bold");
out << "Copyright (C) 2006 - 2009, P. Beckingham."
<< std::endl
out << std::endl
<< ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
? bold.colorize (PACKAGE)
: PACKAGE)
@ -497,9 +494,39 @@ int handleVersion (std::string &outs)
<< ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false))
? bold.colorize (VERSION)
: VERSION)
<< " built for "
#if defined (DARWIN)
<< "darwin"
#elif defined (SOLARIS)
<< "solaris"
#elif defined (CYGWIN)
<< "cygwin"
#elif defined (OPENBSD)
<< "openbsd"
#elif defined (HAIKU)
<< "haiku"
#else
<< "linux"
#endif
// TODO Include: FreeBSD?
#ifdef HAVE_LIBNCURSES
<< "-ncurses"
#endif
#ifdef HAVE_LIBREADLINE
<< "-readline"
#endif
#ifdef HAVE_LIBLUA
<< "-lua"
#endif
<< std::endl
<< "Copyright (C) 2006 - 2009, P. Beckingham."
<< std::endl
<< disclaimer.render ()
<< std::endl
<< (context.config.get ("longversion", true) ? table.render () : "")
<< link.render ()
<< std::endl;