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.
This commit is contained in:
Paul Beckingham 2014-06-20 08:47:15 -04:00
parent de39d1f275
commit 37577fcb03
3 changed files with 52 additions and 3 deletions

View file

@ -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})

46
src/diag.cpp Normal file
View file

@ -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 <cmake.h>
#include <iostream>
#include <cstring>
#include <i18n.h>
#include <text.h>
#ifdef HAVE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
////////////////////////////////////////////////////////////////////////////////
int cmdDiagnostics ()
{
std::cout << "diagnostics\n";
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -35,6 +35,8 @@
#include <readline/history.h>
#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;