From 37577fcb0370976b068cce9e306654221faf3095 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 20 Jun 2014 08:47:15 -0400 Subject: [PATCH] Diagnostics - Added stubbed diagnostics command. This command will be less detailed than the 'task diag' command, focussing on pthread and libreadline versions, taskwarrior version and location, and configuration. --- src/CMakeLists.txt | 3 ++- src/diag.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 6 ++++-- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/diag.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c144679..41594ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,8 @@ include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${TASKSH_INCLUDE_DIRS}) -set (tasksh_SRCS Color.cpp Color.h +set (tasksh_SRCS diag.cpp + Color.cpp Color.h text.cpp text.h) add_executable (tasksh_executable main.cpp ${tasksh_SRCS}) diff --git a/src/diag.cpp b/src/diag.cpp new file mode 100644 index 0000000..c8286d6 --- /dev/null +++ b/src/diag.cpp @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +// http://www.opensource.org/licenses/mit-license.php +// +//////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include + +#ifdef HAVE_READLINE +#include +#include +#endif + +//////////////////////////////////////////////////////////////////////////////// +int cmdDiagnostics () +{ + std::cout << "diagnostics\n"; + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/main.cpp b/src/main.cpp index d892404..ba5f2fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,6 +35,8 @@ #include #endif +int cmdDiagnostics (); + //////////////////////////////////////////////////////////////////////////////// static int commandLoop () { @@ -58,9 +60,9 @@ static int commandLoop () // Dispatch command int status = 0; - if (closeEnough ("exit", command, 3)) status = 1; + if (closeEnough ("exit", command, 3)) status = 1; + else if (closeEnough ("diagnostics", command, 3)) status = cmdDiagnostics (); - // TODO diagnostics // TODO help return status;