- Added stub help command.
This commit is contained in:
Paul Beckingham 2014-06-20 08:50:06 -04:00
parent 37577fcb03
commit 710128c7d7
3 changed files with 45 additions and 0 deletions

View file

@ -4,6 +4,7 @@ include_directories (${CMAKE_SOURCE_DIR}
${TASKSH_INCLUDE_DIRS})
set (tasksh_SRCS diag.cpp
help.cpp
Color.cpp Color.h
text.cpp text.h)

41
src/help.cpp Normal file
View file

@ -0,0 +1,41 @@
////////////////////////////////////////////////////////////////////////////////
//
// 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>
////////////////////////////////////////////////////////////////////////////////
int cmdHelp ()
{
std::cout << "help\n";
return 0;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -35,6 +35,7 @@
#include <readline/history.h>
#endif
int cmdHelp ();
int cmdDiagnostics ();
////////////////////////////////////////////////////////////////////////////////
@ -61,6 +62,8 @@ static int commandLoop ()
// Dispatch command
int status = 0;
if (closeEnough ("exit", command, 3)) status = 1;
else if (closeEnough ("quit", command, 3)) status = 1;
else if (closeEnough ("help", command, 3)) status = cmdHelp ();
else if (closeEnough ("diagnostics", command, 3)) status = cmdDiagnostics ();
// TODO help