mirror of
https://github.com/GothenburgBitFactory/taskshell.git
synced 2025-07-07 20:06:42 +02:00
Compare commits
42 commits
Pre120ToMa
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ba28fd0e04 | ||
![]() |
06687e526b | ||
![]() |
27bdb5019d | ||
![]() |
abf75754f9 | ||
![]() |
61dd5ea775 | ||
![]() |
297b1b53c5 | ||
![]() |
68d8a9acac | ||
![]() |
41a4ed5f22 | ||
![]() |
6bc537b9d9 | ||
![]() |
68864e8526 | ||
![]() |
3f4b2284ad | ||
![]() |
e6d05328cf | ||
![]() |
d2e7b4f31d | ||
![]() |
62de6475b0 | ||
![]() |
8c3580f5c6 | ||
![]() |
87d05ed28a | ||
![]() |
d5bd17cff0 | ||
![]() |
09032052d1 | ||
![]() |
daecfec750 | ||
![]() |
9868566f8d | ||
![]() |
ab7245cb8a | ||
![]() |
a2a900d144 | ||
![]() |
cc2e173d74 | ||
![]() |
fa79935c8b | ||
![]() |
c3d366ce78 | ||
![]() |
0be6d781bd | ||
![]() |
f48b17cddb | ||
![]() |
0f9a8e3877 | ||
![]() |
b3e4867a8d | ||
![]() |
008f183bd1 | ||
![]() |
e967c874a2 | ||
![]() |
13447e1bc8 | ||
![]() |
b8debf69bc | ||
![]() |
ccd21f4060 | ||
![]() |
346e8881e4 | ||
![]() |
cc357231b3 | ||
![]() |
870881a61c | ||
![]() |
dd1856e058 | ||
![]() |
a79664fffe | ||
![]() |
5a4176ac1b | ||
![]() |
97897f6f90 | ||
![]() |
47a692b651 |
23 changed files with 107 additions and 172 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
||||||
[submodule "src/libshared"]
|
[submodule "src/libshared"]
|
||||||
path = src/libshared
|
path = src/libshared
|
||||||
url = https://git.tasktools.org/scm/tm/libshared.git
|
url = https://github.com/GothenburgBitFactory/libshared
|
||||||
|
|
8
AUTHORS
8
AUTHORS
|
@ -3,11 +3,14 @@ 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:
|
||||||
|
@ -19,4 +22,7 @@ suggestions:
|
||||||
jonbobbly
|
jonbobbly
|
||||||
hosaka
|
hosaka
|
||||||
Lars Kumbier
|
Lars Kumbier
|
||||||
Ian R. Learmonth
|
Iain R. Learmonth
|
||||||
|
Eric Hymowitz
|
||||||
|
bjonnh
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ set (HAVE_CMAKE true)
|
||||||
project (tasksh)
|
project (tasksh)
|
||||||
include (CXXSniffer)
|
include (CXXSniffer)
|
||||||
|
|
||||||
set (PROJECT_VERSION "1.1.0")
|
set (PROJECT_VERSION "1.2.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 README.md INSTALL AUTHORS COPYING)
|
set (doc_FILES NEWS ChangeLog 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)
|
||||||
|
|
2
COPYING
2
COPYING
|
@ -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 - 2016, Paul Beckingham, Federico Hernandez.
|
Copyright 2006 - 2017, 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
|
||||||
|
|
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
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
|
||||||
|
@ -11,7 +23,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 Ian R. Learmonth).
|
(thanks to Iain 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
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -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 - 2016, Paul Beckingham, Federico Hernandez.
|
Copyright 2006 - 2017, 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
22
NEWS
|
@ -1,29 +1,23 @@
|
||||||
|
|
||||||
New Features in tasksh 1.1.0
|
New Features in tasksh 1.2.0
|
||||||
|
|
||||||
- Support for a GTD-like review session.
|
- Responds to Ctrl-D by exiting.
|
||||||
|
|
||||||
New commands in tasksh 1.1.0
|
New commands in tasksh 1.2.0
|
||||||
|
|
||||||
- 'review' begins an interactive review session
|
-
|
||||||
- 'diag' shows diagnostic info for problem solving
|
|
||||||
|
|
||||||
New configuration options in tasksh 1.1.0
|
New configuration options in tasksh 1.2.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:
|
||||||
|
|
||||||
* OS X
|
* macOS
|
||||||
* Fedora
|
* Fedora
|
||||||
* Ubuntu
|
* Ubuntu
|
||||||
* Debian
|
* Debian
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# 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,
|
||||||
|
@ -15,3 +21,6 @@ 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.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH tasksh 1 2016-09-06 "${PACKAGE_STRING}" "User Manuals"
|
.TH tasksh 1 2017-05-10 "${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 \- 2016 P. Beckingham, F. Hernandez.
|
Copyright (C) 2006 \- 2017 P. Beckingham, F. Hernandez.
|
||||||
|
|
||||||
This man page was originally written by Federico Hernandez.
|
This man page was originally written by Federico Hernandez.
|
||||||
|
|
||||||
|
|
56
src/diag.cpp
56
src/diag.cpp
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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,33 +48,8 @@ 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.
|
||||||
|
@ -114,18 +89,8 @@ TRING_CMD_DIAG_COMPILER
|
||||||
<< "\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: "
|
||||||
<< compliance
|
<< cppCompliance ()
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
|
|
||||||
std::cout << bold.colorize ("Build Features")
|
std::cout << bold.colorize ("Build Features")
|
||||||
|
@ -161,7 +126,7 @@ TRING_CMD_DIAG_COMPILER
|
||||||
std::cout << bold.colorize ("Configuration")
|
std::cout << bold.colorize ("Configuration")
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
char* env = getenv ("TASKRC");
|
auto env = getenv ("TASKRC");
|
||||||
std::cout << " TASKRC: "
|
std::cout << " TASKRC: "
|
||||||
<< (env ? env : "")
|
<< (env ? env : "")
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
@ -175,12 +140,9 @@ TRING_CMD_DIAG_COMPILER
|
||||||
std::string path (getenv ("PATH"));
|
std::string path (getenv ("PATH"));
|
||||||
std::cout << " PATH: " << path << "\n";
|
std::cout << " PATH: " << path << "\n";
|
||||||
|
|
||||||
std::vector <std::string> paths = split (path, ':');
|
for (const auto& i : 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;
|
||||||
|
@ -188,8 +150,8 @@ TRING_CMD_DIAG_COMPILER
|
||||||
execute ("task", {"--version"}, input, output);
|
execute ("task", {"--version"}, input, output);
|
||||||
|
|
||||||
std::cout << "Taskwarrior: "
|
std::cout << "Taskwarrior: "
|
||||||
<< (*i + "/task")
|
<< i
|
||||||
<< " "
|
<< "/task "
|
||||||
<< output; // Still has \n
|
<< output; // Still has \n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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 83f8ac2a0de4caba98472925ae710c5124ad61c3
|
Subproject commit f1a3cd6bfabfb083fe3c26f580a15c0d60a92ee9
|
25
src/main.cpp
25
src/main.cpp
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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,9 @@
|
||||||
#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
|
||||||
|
@ -67,6 +69,7 @@ const std::string getResponse (const std::string& prompt)
|
||||||
if (! line_read)
|
if (! line_read)
|
||||||
{
|
{
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
|
response = "<EOF>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -83,6 +86,7 @@ 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
|
||||||
|
|
||||||
|
@ -93,22 +97,27 @@ const std::string getResponse (const std::string& prompt)
|
||||||
static int commandLoop (bool autoClear)
|
static int commandLoop (bool autoClear)
|
||||||
{
|
{
|
||||||
// Compose the prompt.
|
// Compose the prompt.
|
||||||
std::string prompt = promptCompose ();
|
auto prompt = promptCompose ();
|
||||||
|
|
||||||
// Display prompt, get input.
|
// Display prompt, get input.
|
||||||
std::string command = getResponse (prompt);
|
auto 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 (command != "")
|
if (! isatty (fileno (stdin)) && command == "")
|
||||||
{
|
{
|
||||||
std::vector <std::string> args = split (command, ' ');
|
status = -1;
|
||||||
|
}
|
||||||
|
else if (command != "")
|
||||||
|
{
|
||||||
|
auto args = split (command, ' ');
|
||||||
|
|
||||||
// Dispatch command.
|
// Dispatch command.
|
||||||
if (closeEnough ("exit", args[0], 3)) status = -1;
|
if (args[0] == "<EOF>") 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 ();
|
||||||
|
@ -155,7 +164,9 @@ int main (int argc, const char** argv)
|
||||||
output == "yes\n" ||
|
output == "yes\n" ||
|
||||||
output == "on\n");
|
output == "on\n");
|
||||||
|
|
||||||
welcome ();
|
if (isatty (fileno (stdin)))
|
||||||
|
welcome ();
|
||||||
|
|
||||||
while ((status = commandLoop (autoClear)) == 0)
|
while ((status = commandLoop (autoClear)) == 0)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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,8 +29,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <Color.h>
|
#include <Color.h>
|
||||||
|
|
||||||
static const char* contextColors[] =
|
static std::vector <std::string> 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",
|
||||||
|
@ -40,8 +39,6 @@ static const char* 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);
|
||||||
|
@ -73,21 +70,14 @@ 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 % NUM_COLORS])
|
+ Color::colorize ("\002 " + contexts[i] + " \001", contextColors[i % contextColors.size ()])
|
||||||
+ "\002";
|
+ "\002";
|
||||||
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
combined += (combined != "" ? " " : "") + contexts[i];
|
||||||
combined += (i ? " " : "") + contexts[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (combined != "")
|
if (combined != "")
|
||||||
combined += ' ';
|
combined += ' ';
|
||||||
|
@ -103,9 +93,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
|
||||||
std::string decoration = composeContexts (true);
|
auto decoration = composeContexts (true);
|
||||||
if (decoration.length ())
|
if (decoration.length ())
|
||||||
return "task " + composeContexts (true) + "> ";
|
return "task " + decoration + "> ";
|
||||||
|
|
||||||
return "tasksh> ";
|
return "tasksh> ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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,12 +65,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +131,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 thing.\n"
|
"accurate, so you are working on the right tasks.\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 "
|
||||||
|
@ -187,8 +181,7 @@ static const std::string banner (
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
static const std::string menu ()
|
static const std::string menu ()
|
||||||
{
|
{
|
||||||
Color text ("color15 on gray6");
|
return Color ("color15 on gray6").colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (m)odify, (c)omplete, (d)elete, (q)uit ") + " ";
|
||||||
return text.colorize (" (Enter) Mark as reviewed, (s)kip, (e)dit, (m)odify, (c)omplete, (d)elete, (q)uit ") + " ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -241,7 +234,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); }
|
||||||
if (response == "m") { modifyTask (uuid); repeat = true; }
|
else 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; }
|
||||||
|
@ -303,7 +296,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-1week ) and ( +PENDING or +WAITING )" }, input, output);
|
"( reviewed.none: or reviewed.before:now-6days ) and ( +PENDING or +WAITING )" }, input, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +312,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.
|
||||||
std::vector <std::string> uuids = split (Lexer::trimRight (output, "\n"), '\n');
|
auto uuids = split (Lexer::trimRight (output, "\n"), '\n');
|
||||||
reviewLoop (uuids, limit, autoClear);
|
reviewLoop (uuids, limit, autoClear);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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;
|
return 0; // Ignore system return code.
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
48
src/text.h
48
src/text.h
|
@ -1,48 +0,0 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
14
test/run_all
14
test/run_all
|
@ -12,6 +12,9 @@ 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
|
||||||
|
@ -19,9 +22,6 @@ 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,7 +60,10 @@ def run_test(testqueue, outqueue, threadname):
|
||||||
class TestRunner(object):
|
class TestRunner(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.threads = []
|
self.threads = []
|
||||||
self.tap = open(cmd_args.tapfile, 'w')
|
if sys.version_info > (3,):
|
||||||
|
self.tap = open(cmd_args.tapfile, 'w', errors='ignore')
|
||||||
|
else:
|
||||||
|
self.tap = open(cmd_args.tapfile, 'w')
|
||||||
|
|
||||||
self._parallelq = Queue()
|
self._parallelq = Queue()
|
||||||
self._serialq = Queue()
|
self._serialq = Queue()
|
||||||
|
@ -197,6 +200,9 @@ 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()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2006-2016, Paul Beckingham, Federico Hernandez.
|
# Copyright 2006 - 2017, 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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
# Copyright 2006 - 2017, 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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2006 - 2017, 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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Copyright 2006 - 2016, Paul Beckingham, Federico Hernandez.
|
# Copyright 2006 - 2017, 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue