Cleanup: Removed calls superceded by CLI

This commit is contained in:
Paul Beckingham 2016-04-03 17:46:49 -04:00
parent 024a9c2f39
commit 6ca48808a8
6 changed files with 1 additions and 114 deletions

View file

@ -15,7 +15,6 @@ set (timew_SRCS CLI.cpp CLI.h
Lexer.cpp Lexer.h
Rules.cpp Rules.h
Timeline.cpp Timeline.h
classifier.cpp
init.cpp
helper.cpp
util.cpp)

View file

@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, 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 <timew.h>
////////////////////////////////////////////////////////////////////////////////
std::vector <std::string> getHints (const std::vector <std::string>& args)
{
std::vector <std::string> hints;
for (auto& arg : args)
if (arg[0] == ':')
hints.push_back (arg);
return hints;
}
////////////////////////////////////////////////////////////////////////////////
// enum class ArgType { binary, command, positional, hint };
ArgType classifyArg (const std::string& arg)
{
if (arg.find ("timew") == arg.length () - 5 ||
arg.find ("ti") == arg.length () - 2)
return ArgType::binary;
// TODO Commands are a problem.
if (arg[0] == ':')
return ArgType::hint;
// The positional args are really just the remainder after the others are
// excluded.
return ArgType::positional;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -42,12 +42,6 @@ void initializeDataAndRules (Database&, Rules&, Log&);
void initializeExtensions (Rules&, Extensions&, Log&);
int dispatchCommand (const std::vector <std::string>&, CLI&, Database&, Rules&, Extensions&, Log&);
// classifier.cpp
std::vector <std::string> getHints (const std::vector <std::string>&);
enum class ArgType { binary, command, positional, hint };
ArgType classifyArg (const std::string&);
// helper.cpp
Color tagColor (const Rules&, const std::string&);
std::string intervalSummarize (const Rules&, const Interval&);

1
test/.gitignore vendored
View file

@ -1,6 +1,5 @@
all.log
*.pyc
classifier.t
composite.t
exclusion.t
interval.t

View file

@ -11,7 +11,7 @@ include_directories (${CMAKE_SOURCE_DIR}
include_directories (${CMAKE_INSTALL_PREFIX}/include)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
set (test_SRCS classifier.t composite.t exclusion.t interval.t lexer.t rules.t util.t)
set (test_SRCS composite.t exclusion.t interval.t lexer.t rules.t util.t)
add_custom_target (test ./run_all --verbose
DEPENDS ${test_SRCS}

View file

@ -1,46 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2015 - 2016, 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 <timew.h>
#include <test.h>
////////////////////////////////////////////////////////////////////////////////
int main (int, char**)
{
UnitTest t (3);
// std::vector <std::string> getHints (const std::vector <std::string>&);
auto result = getHints ({"foo", ":keyword1", ":keyword2"});
t.ok (result.size () == 2, "getHints (foo :keyword1 :keyword2) --> 2");
t.is (result[0], ":keyword1", "getHints (foo :keyword1 :keyword2) [0] --> :keyword1");
t.is (result[1], ":keyword2", "getHints (foo :keyword1 :keyword2) [1] --> :keyword2");
return 0;
}
////////////////////////////////////////////////////////////////////////////////