Compare commits

..

No commits in common. "master" and "Pre120ToMaster" have entirely different histories.

23 changed files with 172 additions and 107 deletions

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "src/libshared"] [submodule "src/libshared"]
path = src/libshared path = src/libshared
url = https://github.com/GothenburgBitFactory/libshared url = https://git.tasktools.org/scm/tm/libshared.git

View file

@ -3,14 +3,11 @@ the following people:
Paul Beckingham (Principal Author) Paul Beckingham (Principal Author)
Federico Hernandez (Principal Author) Federico Hernandez (Principal Author)
Dirk Deimeke (Technical Advisor & Evangelist)
The following submitted code, packages or analysis, and deserve special thanks: The following submitted code, packages or analysis, and deserve special thanks:
Jörg Krause Jörg Krause
Ben Boeckel Ben Boeckel
ilove zfs
Paul Fenwick
Thanks to the following, who submitted detailed bug reports and excellent Thanks to the following, who submitted detailed bug reports and excellent
suggestions: suggestions:
@ -22,7 +19,4 @@ suggestions:
jonbobbly jonbobbly
hosaka hosaka
Lars Kumbier Lars Kumbier
Iain R. Learmonth Ian R. Learmonth
Eric Hymowitz
bjonnh

View file

@ -6,7 +6,7 @@ set (HAVE_CMAKE true)
project (tasksh) project (tasksh)
include (CXXSniffer) include (CXXSniffer)
set (PROJECT_VERSION "1.2.0") set (PROJECT_VERSION "1.1.0")
include (CheckFunctionExists) include (CheckFunctionExists)
include (CheckStructHasMember) include (CheckStructHasMember)
@ -63,7 +63,7 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/test)
add_subdirectory (test EXCLUDE_FROM_ALL) add_subdirectory (test EXCLUDE_FROM_ALL)
endif (EXISTS ${CMAKE_SOURCE_DIR}/test) endif (EXISTS ${CMAKE_SOURCE_DIR}/test)
set (doc_FILES NEWS ChangeLog INSTALL AUTHORS COPYING) set (doc_FILES NEWS ChangeLog README.md INSTALL AUTHORS COPYING)
foreach (doc_FILE ${doc_FILES}) foreach (doc_FILE ${doc_FILES})
install (FILES ${doc_FILE} DESTINATION ${TASKSH_DOCDIR}) install (FILES ${doc_FILE} DESTINATION ${TASKSH_DOCDIR})
endforeach (doc_FILE) endforeach (doc_FILE)

View file

@ -1,6 +1,6 @@
tasksh - a shell/frontend for the command line task list manager taskwarrior. tasksh - a shell/frontend for the command line task list manager taskwarrior.
Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -1,15 +1,3 @@
1.2.0 (2017-05-10) 3f4b2284ad19beacd30e202e6c700a36c2b65c60
- TS-29 tasksh hangs trying to read task from stdin
(thanks to ilove zfs).
- TS-32 control-d to exit
(thanks to Eric Hymowitz, Paul Fenwick).
- TS-34 Tasksh throw a warning at the end of a review command
(thanks to bjonnh).
- Review report now defaults to 6 days instead of 1 weeķ, which is more
convenient for those who review weekly
(thanks to Dirk Deimeke).
------ current release --------------------------- ------ current release ---------------------------
1.1.0 (2016-09-06) 464f5ae19f853911e739c2489897aef64345c388 1.1.0 (2016-09-06) 464f5ae19f853911e739c2489897aef64345c388
@ -23,7 +11,7 @@
- TS-24 add review option (m)odify - TS-24 add review option (m)odify
(thanks to David Patrick). (thanks to David Patrick).
- TS-28 Please add a (m)odify feature for review - TS-28 Please add a (m)odify feature for review
(thanks to Iain R. Learmonth). (thanks to Ian R. Learmonth).
- Implemented 'review' command. - Implemented 'review' command.
- Implemented 'diag' command. - Implemented 'diag' command.
- Added 'review N' option, to specify the number of tasks you would like to - Added 'review N' option, to specify the number of tasks you would like to

View file

@ -1,6 +1,6 @@
tasksh - a shell/frontend for ithe command line task list manager taskwarrior. tasksh - a shell/frontend for ithe command line task list manager taskwarrior.
Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

22
NEWS
View file

@ -1,23 +1,29 @@
New Features in tasksh 1.2.0 New Features in tasksh 1.1.0
- Responds to Ctrl-D by exiting. - Support for a GTD-like review session.
New commands in tasksh 1.2.0 New commands in tasksh 1.1.0
- - 'review' begins an interactive review session
- 'diag' shows diagnostic info for problem solving
New configuration options in tasksh 1.2.0 New configuration options in tasksh 1.1.0
- - The 'tasksh.autoclear' setting in Taskwarrior is used by Tasksh to clear
the terminal before every command, if set to '1'.
Known Issues Known Issues
- - Spaces in project names in tasksh
https://bug.tasktools.org/browse/TS-3
- Tasksh throws errors on unescaped parentheses
https://bug.tasktools.org/browse/TS-23
Tasksh has been built and tested on the following configurations: Tasksh has been built and tested on the following configurations:
* macOS * OS X
* Fedora * Fedora
* Ubuntu * Ubuntu
* Debian * Debian

View file

@ -1,9 +1,3 @@
# Installing
* Debian/Ubuntu:
```
$ sudo apt-get install tasksh
```
# Disclaimer during ongoing development # Disclaimer during ongoing development
The development branch is a work in progress and may not pass all quality tests, The development branch is a work in progress and may not pass all quality tests,
@ -21,6 +15,3 @@ Thank you for taking a look at tasksh!!
--- ---
Tasksh is released under the MIT license. For details check the LICENSE file. Tasksh is released under the MIT license. For details check the LICENSE file.
# Important note
When cloning this from the repo to build from source make sure you `git clone --recursive` to get all required submodules.

View file

@ -1,4 +1,4 @@
.TH tasksh 1 2017-05-10 "${PACKAGE_STRING}" "User Manuals" .TH tasksh 1 2016-09-06 "${PACKAGE_STRING}" "User Manuals"
.SH NAME .SH NAME
tasksh \- Interactive taskwarrior shell tasksh \- Interactive taskwarrior shell
@ -144,7 +144,7 @@ If set to "1", causes each tasksh command to be preceded by a 'clear screen' and
cursor reset. Default is "0". cursor reset. Default is "0".
.SH "CREDITS & COPYRIGHTS" .SH "CREDITS & COPYRIGHTS"
Copyright (C) 2006 \- 2017 P. Beckingham, F. Hernandez. Copyright (C) 2006 \- 2016 P. Beckingham, F. Hernandez.
This man page was originally written by Federico Hernandez. This man page was originally written by Federico Hernandez.

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -48,8 +48,33 @@ int cmdDiagnostics ()
std::cout << "\n" std::cout << "\n"
<< bold.colorize (PACKAGE_STRING) << bold.colorize (PACKAGE_STRING)
<< "\n" << "\n";
<< " " << "Platform: " << osName ()
std::cout << " " << "Platform: "
<<
#if defined (DARWIN)
"Darwin"
#elif defined (SOLARIS)
"Solaris"
#elif defined (CYGWIN)
"Cygwin"
#elif defined (HAIKU)
"Haiku"
#elif defined (OPENBSD)
"OpenBSD"
#elif defined (FREEBSD)
"FreeBSD"
#elif defined (NETBSD)
"NetBSD"
#elif defined (LINUX)
"Linux"
#elif defined (KFREEBSD)
TRING_CMD_DIAG_COMPILER
#elif defined (GNUHURD)
"GNU/Hurd"
#else
"Unknown"
#endif
<< "\n\n"; << "\n\n";
// Compiler. // Compiler.
@ -89,8 +114,18 @@ int cmdDiagnostics ()
<< "\n"; << "\n";
// Compiler compliance level. // Compiler compliance level.
std::string compliance = "non-compliant";
#ifdef __cplusplus
int level = __cplusplus;
if (level == 199711)
compliance = "C++98/03";
else if (level == 201103)
compliance = "C++11";
else
compliance = format (level);
#endif
std::cout << " Compliance: " std::cout << " Compliance: "
<< cppCompliance () << compliance
<< "\n\n"; << "\n\n";
std::cout << bold.colorize ("Build Features") std::cout << bold.colorize ("Build Features")
@ -126,7 +161,7 @@ int cmdDiagnostics ()
std::cout << bold.colorize ("Configuration") std::cout << bold.colorize ("Configuration")
<< "\n"; << "\n";
auto env = getenv ("TASKRC"); char* env = getenv ("TASKRC");
std::cout << " TASKRC: " std::cout << " TASKRC: "
<< (env ? env : "") << (env ? env : "")
<< "\n"; << "\n";
@ -140,9 +175,12 @@ int cmdDiagnostics ()
std::string path (getenv ("PATH")); std::string path (getenv ("PATH"));
std::cout << " PATH: " << path << "\n"; std::cout << " PATH: " << path << "\n";
for (const auto& i : split (path, ':')) std::vector <std::string> paths = split (path, ':');
std::vector <std::string>::iterator i;
for (i = paths.begin (); i != paths.end (); ++i)
{ {
File task (i + "/task"); File task (*i + "/task");
if (task.exists ()) if (task.exists ())
{ {
std::string input; std::string input;
@ -150,8 +188,8 @@ int cmdDiagnostics ()
execute ("task", {"--version"}, input, output); execute ("task", {"--version"}, input, output);
std::cout << "Taskwarrior: " std::cout << "Taskwarrior: "
<< i << (*i + "/task")
<< "/task " << " "
<< output; // Still has \n << output; // Still has \n
} }
} }

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int cmdHelp () int cmdHelp ()
{ {
std::cout << '\n' std::cout << "\n"
<< " Commands:\n" << " Commands:\n"
<< " tasksh> list Or any other Taskwarrior command\n" << " tasksh> list Or any other Taskwarrior command\n"
<< " tasksh> review [N] Task review session, with optional cutoff after N tasks\n" << " tasksh> review [N] Task review session, with optional cutoff after N tasks\n"
@ -38,10 +38,10 @@ int cmdHelp ()
<< " tasksh> help Tasksh help\n" << " tasksh> help Tasksh help\n"
<< " tasksh> diagnostics Tasksh diagnostics\n" << " tasksh> diagnostics Tasksh diagnostics\n"
<< " tasksh> quit End of session. May also use 'exit'\n" << " tasksh> quit End of session. May also use 'exit'\n"
<< '\n' << "\n"
<< "Run 'man tasksh' from your shell prompt.\n" << "Run 'man tasksh' from your shell prompt.\n"
<< "Run '! man tasksh' from inside tasksh.\n" << "Run '! man tasksh' from inside tasksh.\n"
<< '\n'; << "\n";
return 0; return 0;
} }

@ -1 +1 @@
Subproject commit f1a3cd6bfabfb083fe3c26f580a15c0d60a92ee9 Subproject commit 83f8ac2a0de4caba98472925ae710c5124ad61c3

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -29,9 +29,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <cstdio>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <shared.h> #include <shared.h>
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
@ -69,7 +67,6 @@ const std::string getResponse (const std::string& prompt)
if (! line_read) if (! line_read)
{ {
std::cout << "\n"; std::cout << "\n";
response = "<EOF>";
} }
else else
{ {
@ -86,7 +83,6 @@ const std::string getResponse (const std::string& prompt)
if (std::cin.eof () == 1) if (std::cin.eof () == 1)
{ {
std::cout << "\n"; std::cout << "\n";
response = "<EOF>";
} }
#endif #endif
@ -97,27 +93,22 @@ const std::string getResponse (const std::string& prompt)
static int commandLoop (bool autoClear) static int commandLoop (bool autoClear)
{ {
// Compose the prompt. // Compose the prompt.
auto prompt = promptCompose (); std::string prompt = promptCompose ();
// Display prompt, get input. // Display prompt, get input.
auto command = getResponse (prompt); std::string command = getResponse (prompt);
// Obey Taskwarrior's rc.tasksh.autoclear. // Obey Taskwarrior's rc.tasksh.autoclear.
if (autoClear) if (autoClear)
std::cout << "\033[2J\033[0;0H"; std::cout << "\033[2J\033[0;0H";
int status = 0; int status = 0;
if (! isatty (fileno (stdin)) && command == "") if (command != "")
{ {
status = -1; std::vector <std::string> args = split (command, ' ');
}
else if (command != "")
{
auto args = split (command, ' ');
// Dispatch command. // Dispatch command.
if (args[0] == "<EOF>") status = -1; if (closeEnough ("exit", args[0], 3)) status = -1;
else if (closeEnough ("exit", args[0], 3)) status = -1;
else if (closeEnough ("quit", args[0], 3)) status = -1; else if (closeEnough ("quit", args[0], 3)) status = -1;
else if (closeEnough ("help", args[0], 3)) status = cmdHelp (); else if (closeEnough ("help", args[0], 3)) status = cmdHelp ();
else if (closeEnough ("diagnostics", args[0], 3)) status = cmdDiagnostics (); else if (closeEnough ("diagnostics", args[0], 3)) status = cmdDiagnostics ();
@ -164,9 +155,7 @@ int main (int argc, const char** argv)
output == "yes\n" || output == "yes\n" ||
output == "on\n"); output == "on\n");
if (isatty (fileno (stdin)))
welcome (); welcome ();
while ((status = commandLoop (autoClear)) == 0) while ((status = commandLoop (autoClear)) == 0)
; ;
} }

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -29,7 +29,8 @@
#include <string> #include <string>
#include <Color.h> #include <Color.h>
static std::vector <std::string> contextColors = { static const char* contextColors[] =
{
"bold white on red", "bold white on red",
"bold white on blue", "bold white on blue",
"bold white on green", "bold white on green",
@ -39,6 +40,8 @@ static std::vector <std::string> contextColors = {
"black on white", "black on white",
}; };
#define NUM_COLORS (sizeof (contextColors) / sizeof (contextColors[0]))
static std::vector <std::string> contexts; static std::vector <std::string> contexts;
std::string composeContexts (bool pretty = false); std::string composeContexts (bool pretty = false);
@ -70,14 +73,21 @@ int promptAdd (const std::string& context)
std::string composeContexts (bool pretty /* = false */) std::string composeContexts (bool pretty /* = false */)
{ {
std::string combined; std::string combined;
for (unsigned int i = 0; i < contexts.size (); i++) for (unsigned int i = 0; i < contexts.size (); ++i)
{
if (pretty) if (pretty)
combined += (combined != "" ? " " : "") {
combined += (i ? " " : "")
+ std::string ("\001") + std::string ("\001")
+ Color::colorize ("\002 " + contexts[i] + " \001", contextColors[i % contextColors.size ()]) + Color::colorize ("\002 " + contexts[i] + " \001", contextColors[i % NUM_COLORS])
+ "\002"; + "\002";
}
else else
combined += (combined != "" ? " " : "") + contexts[i]; {
combined += (i ? " " : "") + contexts[i];
}
}
if (combined != "") if (combined != "")
combined += ' '; combined += ' ';
@ -93,9 +103,9 @@ std::string promptCompose ()
// TODO - The accumulated context, as colored tokens. // TODO - The accumulated context, as colored tokens.
// TODO - sync status // TODO - sync status
// TODO - time // TODO - time
auto decoration = composeContexts (true); std::string decoration = composeContexts (true);
if (decoration.length ()) if (decoration.length ())
return "task " + decoration + "> "; return "task " + composeContexts (true) + "> ";
return "tasksh> "; return "tasksh> ";
} }

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -65,6 +65,12 @@ static unsigned int getWidth ()
width = buff[1]; width = buff[1];
} }
// Ncurses does this, and perhaps we need to as well, to avoid a problem on
// Cygwin where the display goes right up to the terminal width, and causes
// an odd color wrapping problem.
// if (config.getBoolean ("avoidlastcolumn"))
// --width;
return width; return width;
} }
@ -131,7 +137,7 @@ static const std::string reviewStart (
unsigned int width) unsigned int width)
{ {
std::string welcome = "The review process is important for keeping your list " std::string welcome = "The review process is important for keeping your list "
"accurate, so you are working on the right tasks.\n" "accurate, so you are working on the right thing.\n"
"\n" "\n"
"For each task you are shown, look at the metadata. " "For each task you are shown, look at the metadata. "
"Determine whether the task needs to be changed (enter " "Determine whether the task needs to be changed (enter "
@ -181,7 +187,8 @@ static const std::string banner (
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static const std::string menu () static const std::string menu ()
{ {
return Color ("color15 on gray6").colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (m)odify, (c)omplete, (d)elete, (q)uit ") + " "; Color text ("color15 on gray6");
return text.colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (m)odify, (c)omplete, (d)elete, (q)uit ") + " ";
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -234,7 +241,7 @@ static void reviewLoop (const std::vector <std::string>& uuids, unsigned int lim
response = getResponse (menu ()); response = getResponse (menu ());
if (response == "e") { editTask (uuid); } if (response == "e") { editTask (uuid); }
else if (response == "m") { modifyTask (uuid); repeat = true; } if (response == "m") { modifyTask (uuid); repeat = true; }
else if (response == "s") { std::cout << "Skipped\n\n"; ++current; } else if (response == "s") { std::cout << "Skipped\n\n"; ++current; }
else if (response == "c") { completeTask (uuid); ++current; ++reviewed; } else if (response == "c") { completeTask (uuid); ++current; ++reviewed; }
else if (response == "d") { deleteTask (uuid); ++current; ++reviewed; } else if (response == "d") { deleteTask (uuid); ++current; ++reviewed; }
@ -296,7 +303,7 @@ int cmdReview (const std::vector <std::string>& args, bool autoClear)
execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.columns", "uuid" }, input, output); execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.columns", "uuid" }, input, output);
execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.sort", "reviewed+,modified+"}, input, output); execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.sort", "reviewed+,modified+"}, input, output);
execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.filter", execute ("task", {"rc.confirmation:no", "rc.verbose:nothing", "config", "report._reviewed.filter",
"( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING )" }, input, output); "( reviewed.none: or reviewed.before:now-1week ) and ( +PENDING or +WAITING )" }, input, output);
} }
} }
@ -312,7 +319,7 @@ int cmdReview (const std::vector <std::string>& args, bool autoClear)
input, output); input, output);
// Review the set of UUIDs. // Review the set of UUIDs.
auto uuids = split (Lexer::trimRight (output, "\n"), '\n'); std::vector <std::string> uuids = split (Lexer::trimRight (output, "\n"), '\n');
reviewLoop (uuids, limit, autoClear); reviewLoop (uuids, limit, autoClear);
return 0; return 0;
} }

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -40,7 +40,7 @@ int cmdShell (const std::vector <std::string>& args)
combined = combined.substr (1); combined = combined.substr (1);
system (combined.c_str ()); system (combined.c_str ());
return 0; // Ignore system return code. return 0;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

48
src/text.h Normal file
View file

@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2006 - 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
//
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_TEXT
#define INCLUDED_TEXT
#include <string>
#include <vector>
void wrapText (std::vector <std::string>&, const std::string&, const int, bool);
std::string trimLeft (const std::string& in, const std::string& t = " ");
std::string trimRight (const std::string& in, const std::string& t = " ");
std::string trim (const std::string& in, const std::string& t = " ");
bool extractLine (std::string&, const std::string&, int, bool, unsigned int&);
void split (std::vector<std::string>&, const std::string&, const char);
void join (std::string&, const std::string&, const std::vector<std::string>&);
std::string lowerCase (const std::string&);
bool compare (const std::string&, const std::string&, bool sensitive = true);
bool closeEnough (const std::string&, const std::string&, unsigned int minLength = 0);
const std::string format (int);
const std::string format (const std::string&, const std::string&);
const std::string format (const std::string&, int, int);
#endif
////////////////////////////////////////////////////////////////////////////////

View file

@ -12,9 +12,6 @@ from multiprocessing import cpu_count
from threading import Thread from threading import Thread
from subprocess import call, Popen, PIPE from subprocess import call, Popen, PIPE
if sys.version_info > (3,):
import codecs
try: try:
# python 2 # python 2
from Queue import Queue, Empty from Queue import Queue, Empty
@ -22,6 +19,9 @@ except ImportError:
# python 3 # python 3
from queue import Queue, Empty from queue import Queue, Empty
# Look for taskd in $PATH instead of task/src/
os.environ["TASKD_USE_PATH"] = "1"
TIMEOUT = .2 TIMEOUT = .2
@ -60,9 +60,6 @@ def run_test(testqueue, outqueue, threadname):
class TestRunner(object): class TestRunner(object):
def __init__(self): def __init__(self):
self.threads = [] self.threads = []
if sys.version_info > (3,):
self.tap = open(cmd_args.tapfile, 'w', errors='ignore')
else:
self.tap = open(cmd_args.tapfile, 'w') self.tap = open(cmd_args.tapfile, 'w')
self._parallelq = Queue() self._parallelq = Queue()
@ -200,9 +197,6 @@ def parse_args():
def main(): def main():
if sys.version_info > (3,):
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
runner = TestRunner() runner = TestRunner()
runner.start() runner.start()

View file

@ -1,6 +1,6 @@
############################################################################### ###############################################################################
# #
# Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. # Copyright 2006-2016, Paul Beckingham, Federico Hernandez.
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ###############################################################################
# #
# Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. # Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal

View file

@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ###############################################################################
# #
# Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. # Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal