Compare commits
279 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9dc0813d9 | ||
|
|
25c687e1ec | ||
|
|
6e98bbbd85 | ||
|
|
06c8976be5 | ||
|
|
d13a5a3f47 | ||
|
|
b662afa1ff | ||
|
|
bde83d3195 | ||
|
|
0edb7e57f6 | ||
|
|
4569d2da24 | ||
|
|
6b00f08794 | ||
|
|
e83809c6aa | ||
|
|
39b736d23e | ||
|
|
3e90554f40 | ||
|
|
4690b1a6cb | ||
|
|
ce1a7b921c | ||
|
|
7a1645bba3 | ||
|
|
9f1b3e0d56 | ||
|
|
0af8b1dbab | ||
|
|
1465bcb918 | ||
|
|
4eb70e68b7 | ||
|
|
cd216bd4fd | ||
|
|
ac4a5c6d62 | ||
|
|
a67593decf | ||
|
|
7be294267b | ||
|
|
920cdcca10 | ||
|
|
7cc410f58e | ||
|
|
5d42c0f6b6 | ||
|
|
cff680d074 | ||
|
|
dda190703e | ||
|
|
281edcc38f | ||
|
|
87d00698db | ||
|
|
19674ee339 | ||
|
|
9f654a5c95 | ||
|
|
87e9578666 | ||
|
|
e3ec52f6ca | ||
|
|
70c3d9845c | ||
|
|
9d1c4101c2 | ||
|
|
44ed974fa2 | ||
|
|
3cf7a701c8 | ||
|
|
d390f99fc5 | ||
|
|
a2cae67644 | ||
|
|
ebd6977480 | ||
|
|
276050ce0b | ||
|
|
197815a3a7 | ||
|
|
5e8426f0cc | ||
|
|
138360b7bc | ||
|
|
7fa3c5ac84 | ||
|
|
b5da4acab9 | ||
|
|
180c382de2 | ||
|
|
23d4e2b3c9 | ||
|
|
96185cbd61 | ||
|
|
7665d13d42 | ||
|
|
a40967a324 | ||
|
|
01feec568b | ||
|
|
104aeb3905 | ||
|
|
f0cc0151b7 | ||
|
|
48be6986c2 | ||
|
|
ffd6465661 | ||
|
|
58e62711f3 | ||
|
|
3b9d88a87b | ||
|
|
aa8cd54142 | ||
|
|
651ac3f174 | ||
|
|
ea78200ae3 | ||
|
|
ad89a90d12 | ||
|
|
85d0e1789a | ||
|
|
e19c99ce1e | ||
|
|
0868ba757c | ||
|
|
bf5f246168 | ||
|
|
9748fa2ab1 | ||
|
|
1a0f479394 | ||
|
|
e2f35a1a06 | ||
|
|
394acae790 | ||
|
|
e8d385119a | ||
|
|
070fdf60fa | ||
|
|
1278226c16 | ||
|
|
98410cff42 | ||
|
|
ee23a099f2 | ||
|
|
0ab1dc0c9c | ||
|
|
c2a9bb65e6 | ||
|
|
75cf742a55 | ||
|
|
dc0502dd9f | ||
|
|
3a77a5f291 | ||
|
|
1abda3900b | ||
|
|
09fe5be086 | ||
|
|
1a3550541b | ||
|
|
371ca27da0 | ||
|
|
5f3dd43893 | ||
|
|
edb54a51b3 | ||
|
|
636f6bfd96 | ||
|
|
e91063426a | ||
|
|
a4d5ab07e9 | ||
|
|
49a7e46eaf | ||
|
|
0891ed4b57 | ||
|
|
af772f4c49 | ||
|
|
3484e44c7d | ||
|
|
be855af8c4 | ||
|
|
1ae4ea2ea3 | ||
|
|
d37937d970 | ||
|
|
51e947064f | ||
|
|
606a7505d3 | ||
|
|
846dd14a9f | ||
|
|
d8f436cca9 | ||
|
|
ac9c726782 | ||
|
|
88d65b23c1 | ||
|
|
f2998aba74 | ||
|
|
d2b2631db7 | ||
|
|
4c491d8a0d | ||
|
|
917a152a1e | ||
|
|
289e45499a | ||
|
|
2efb9594d9 | ||
|
|
0d096a5a42 | ||
|
|
cc1c063925 | ||
|
|
dd31a15001 | ||
|
|
c11601e30e | ||
|
|
520067f522 | ||
|
|
693fe9b8fd | ||
|
|
fa249bfedd | ||
|
|
952d743218 | ||
|
|
91f6980d2f | ||
|
|
d211969236 | ||
|
|
bd320b6729 | ||
|
|
3f004f547e | ||
|
|
3b192cddcf | ||
|
|
ca6061a987 | ||
|
|
2787ee960b | ||
|
|
c27ad4dc27 | ||
|
|
a36eb974ee | ||
|
|
a55a7bf1a2 | ||
|
|
82e019a4a8 | ||
|
|
9180aa6e33 | ||
|
|
32d837fb25 | ||
|
|
395b08385b | ||
|
|
9cc9e19757 | ||
|
|
c07d74574d | ||
|
|
73401664b6 | ||
|
|
d052b8752d | ||
|
|
68d9e3bb5e | ||
|
|
86837022d3 | ||
|
|
e831f85823 | ||
|
|
4b839f2c83 | ||
|
|
1e1bd32c42 | ||
|
|
880ab5d665 | ||
|
|
ef583dedea | ||
|
|
1bd26fe9ab | ||
|
|
80c01f3ffb | ||
|
|
7cd42b5d2f | ||
|
|
1b218d68f5 | ||
|
|
e6031183dd | ||
|
|
f9bcb8cfc8 | ||
|
|
2ef0214248 | ||
|
|
0a62061ca8 | ||
|
|
5d96547c07 | ||
|
|
eb3afa1fdc | ||
|
|
885ff46066 | ||
|
|
5a060802e7 | ||
|
|
acce2d5a68 | ||
|
|
adac566665 | ||
|
|
f454eecafb | ||
|
|
f83702076b | ||
|
|
83519a44c6 | ||
|
|
a2e980c6b8 | ||
|
|
e00704a375 | ||
|
|
8fb3161a02 | ||
|
|
fa528beb58 | ||
|
|
c5a2b7f759 | ||
|
|
4213afd408 | ||
|
|
8ad0c1172e | ||
|
|
f887173bf7 | ||
|
|
328b7ec260 | ||
|
|
ab41e005c9 | ||
|
|
bd785ffad5 | ||
|
|
3cce6c23f5 | ||
|
|
ec919a8677 | ||
|
|
5911286218 | ||
|
|
9e49325d6e | ||
|
|
c483c8dda9 | ||
|
|
2d2579d801 | ||
|
|
4f6c51e7ae | ||
|
|
cd6808ab15 | ||
|
|
8b648bc690 | ||
|
|
9a0a6188b1 | ||
|
|
b79453afa7 | ||
|
|
60dddffda3 | ||
|
|
e8dc5a16a1 | ||
|
|
528e72062b | ||
|
|
876820ee1a | ||
|
|
8e730f2da3 | ||
|
|
8b28c36485 | ||
|
|
04be198281 | ||
|
|
1b69ac6ad2 | ||
|
|
b1081bd510 | ||
|
|
a72322b9db | ||
|
|
82e6574d30 | ||
|
|
1f14454be7 | ||
|
|
384ca82292 | ||
|
|
066143d939 | ||
|
|
e845a25ea6 | ||
|
|
75a2b11638 | ||
|
|
6a3edc88a1 | ||
|
|
bb3555f217 | ||
|
|
5de80eedeb | ||
|
|
10c1b5f902 | ||
|
|
049ed04471 | ||
|
|
3ff42af9c7 | ||
|
|
1cfdfbae52 | ||
|
|
61291e4d1e | ||
|
|
77ec56dcd0 | ||
|
|
d0f74c4a80 | ||
|
|
4bdee56fa7 | ||
|
|
8323407242 | ||
|
|
6626207ad1 | ||
|
|
4865269630 | ||
|
|
8683574b18 | ||
|
|
5e90510530 | ||
|
|
a8bab90c34 | ||
|
|
87c2a9b5a5 | ||
|
|
cba5948a1d | ||
|
|
f4a6ec6f97 | ||
|
|
a3490966c0 | ||
|
|
855537b975 | ||
|
|
473019c1f0 | ||
|
|
d1698eab2d | ||
|
|
73b7b21b81 | ||
|
|
44f2c0c98c | ||
|
|
654159b2fd | ||
|
|
67cb30fdce | ||
|
|
7d75547f44 | ||
|
|
d68fa7ea8a | ||
|
|
db78851b40 | ||
|
|
6fdf0738a7 | ||
|
|
41003fc78b | ||
|
|
d2928dc4e4 | ||
|
|
61deb7ce7e | ||
|
|
0311ea6689 | ||
|
|
0b0ddbfbc4 | ||
|
|
cd31335742 | ||
|
|
5a3037f257 | ||
|
|
a22d173b9b | ||
|
|
134d201cb0 | ||
|
|
547d9edb55 | ||
|
|
cdde747733 | ||
|
|
588009d679 | ||
|
|
adf9f25289 | ||
|
|
ea0397f542 | ||
|
|
411fab3a27 | ||
|
|
da6a57b203 | ||
|
|
235e4ef047 | ||
|
|
1dbb0a57a8 | ||
|
|
5a7117630e | ||
|
|
e9f9f6a86e | ||
|
|
8ea1563944 | ||
|
|
e522c1980a | ||
|
|
845fe047cc | ||
|
|
5932d9f90b | ||
|
|
a8ff7655ef | ||
|
|
79cc9d8ed9 | ||
|
|
b83dc8a29e | ||
|
|
99ebf82c3a | ||
|
|
231e8ca913 | ||
|
|
9bd9a3b285 | ||
|
|
b882cd151e | ||
|
|
a3b0d5c6a6 | ||
|
|
d1664b3f55 | ||
|
|
1cac14f3f8 | ||
|
|
507e2d5807 | ||
|
|
c664d62c2f | ||
|
|
f32c4d1f73 | ||
|
|
9bf7dfda4f | ||
|
|
2a782b8f01 | ||
|
|
3c07510a43 | ||
|
|
07eff0f3c1 | ||
|
|
dad0ac0c27 | ||
|
|
2c986d6e6b | ||
|
|
1e8f83cab9 | ||
|
|
15f00452c2 | ||
|
|
6a3b13dbfc | ||
|
|
8180b94b1b | ||
|
|
6aafa9f04e | ||
|
|
fe07f62214 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@ cmake.h
|
||||
commit.h
|
||||
Makefile
|
||||
src/task
|
||||
src/taskd
|
||||
src/libtask.a
|
||||
src/commands/libcommands.a
|
||||
src/columns/libcolumns.a
|
||||
|
||||
10
AUTHORS
10
AUTHORS
@@ -13,6 +13,7 @@ contributions of the following people:
|
||||
Louis-Claude Canon (Contributing Author)
|
||||
Scott Kostyshak (Contributing Author)
|
||||
Renato Alves (Contributing Author)
|
||||
Tomas Babej (Contributing Author)
|
||||
|
||||
The following submitted code, packages or analysis, and deserve special thanks:
|
||||
|
||||
@@ -112,6 +113,8 @@ The following submitted code, packages or analysis, and deserve special thanks:
|
||||
Jeremy John Reeder
|
||||
Roman Inflianskas
|
||||
Łukasz Panek
|
||||
V.Krishn
|
||||
Jens Erat
|
||||
|
||||
Thanks to the following, who submitted detailed bug reports and excellent
|
||||
suggestions:
|
||||
@@ -233,10 +236,13 @@ suggestions:
|
||||
dev-zero
|
||||
Petteri
|
||||
Black Ops Testing
|
||||
Jens Erat
|
||||
Leon Feng
|
||||
Tomas Babej
|
||||
Nick Person
|
||||
Arnoud K
|
||||
Ozgur Akgun
|
||||
David Costa
|
||||
Sujeevan Vijayakumaran
|
||||
Scott Carter
|
||||
Taisuke Hachimura
|
||||
Martin
|
||||
Alexandre de Verteuil
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
|
||||
if(POLICY CMP0037)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
endif()
|
||||
|
||||
include (CheckFunctionExists)
|
||||
include (CheckStructHasMember)
|
||||
@@ -7,12 +10,40 @@ include (CheckStructHasMember)
|
||||
set (HAVE_CMAKE true)
|
||||
|
||||
project (task)
|
||||
set (PROJECT_VERSION "2.4.0")
|
||||
set (PROJECT_VERSION "2.4.2")
|
||||
|
||||
OPTION(USE_GNUTLS "Build gnutls support." ON)
|
||||
|
||||
message ("CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
include (CheckCXXCompilerFlag)
|
||||
|
||||
# NOTE: If we are to actually use C++11 features, we should either require
|
||||
# a compiler that supports the -std=c++11 flag or check for the
|
||||
# features used.
|
||||
# Relying on -std=c++0x or even -std=gnu++0x is highly volatile.
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" _HAS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" _HAS_CXX0X)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" _HAS_GNU0X)
|
||||
|
||||
if (_HAS_CXX11)
|
||||
set (_CXX11_FLAGS "-std=c++11")
|
||||
elseif (_HAS_CXX0X)
|
||||
message (WARNING "Enabling -std=c++0x draft compile flag. Your compiler does not support the standard '-std=c++11' option. Consider upgrading.")
|
||||
set (_CXX11_FLAGS "-std=c++0x")
|
||||
elseif (_HAS_GNU0X)
|
||||
message (WARNING "Enabling -std=gnu++0x draft compile flag. Your compiler does not support the standard '-std=c++11' option. Consider upgrading.")
|
||||
set (_CXX11_FLAGS "-std=gnu++0x")
|
||||
else (_HAS_CXX11)
|
||||
message (FATAL_ERROR "C++11 support missing. Try upgrading your C++ compiler. If you have a good reason for using an outdated compiler, please let us know at support@taskwarrior.org.")
|
||||
endif (_HAS_CXX11)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (LINUX true)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set (DARWIN true)
|
||||
set (_CXX11_FLAGS "${_CXX11_FLAGS} -stdlib=libc++")
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
|
||||
set (KFREEBSD true)
|
||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
@@ -25,10 +56,18 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
set (SOLARIS true)
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU")
|
||||
set (GNUHURD true)
|
||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
|
||||
set (CYGWIN true)
|
||||
# NOTE: Not setting -std=gnu++0x leads to compile errors even with
|
||||
# GCC 4.8.3, and debugging those leads to insanity. Adding this
|
||||
# workaround instead of fixing Cygwin.
|
||||
set (_CXX11_FLAGS "-std=gnu++0x")
|
||||
else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set (UNKNOWN true)
|
||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
set (CMAKE_CXX_FLAGS "${_CXX11_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
if (NETBSD)
|
||||
# Since readline, etc likely to be in /usr/pkg/lib, not standard library
|
||||
# Otherwise will remove links during install
|
||||
@@ -65,23 +104,15 @@ set (PACKAGE_TARNAME "${PACKAGE}")
|
||||
set (PACKAGE_VERSION "${VERSION}")
|
||||
set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
|
||||
|
||||
message ("-- Looking for GnuTLS")
|
||||
find_package (GnuTLS)
|
||||
if (GNUTLS_FOUND)
|
||||
set (HAVE_LIBGNUTLS true)
|
||||
set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${GNUTLS_INCLUDE_DIR})
|
||||
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${GNUTLS_LIBRARIES})
|
||||
endif (GNUTLS_FOUND)
|
||||
|
||||
#message ("-- Looking for pthread")
|
||||
#find_path (PTHREAD_INCLUDE_DIR pthread.h)
|
||||
#find_library (PTHREAD_LIBRARY NAMES pthread)
|
||||
#if (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
|
||||
# message ("-- Found pthread: ${PTHREAD_LIBRARY}")
|
||||
# set (HAVE_LIBPTHREAD true)
|
||||
# set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIR})
|
||||
# set (TASK_LIBRARIES ${TASK_LIBRARIES} ${PTHREAD_LIBRARIES})
|
||||
#endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
|
||||
if (USE_GNUTLS)
|
||||
message ("-- Looking for GnuTLS")
|
||||
find_package (GnuTLS)
|
||||
if (GNUTLS_FOUND)
|
||||
set (HAVE_LIBGNUTLS true)
|
||||
set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${GNUTLS_INCLUDE_DIR})
|
||||
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${GNUTLS_LIBRARIES})
|
||||
endif (GNUTLS_FOUND)
|
||||
endif (USE_GNUTLS)
|
||||
|
||||
check_function_exists (timegm HAVE_TIMEGM)
|
||||
check_function_exists (get_current_dir_name HAVE_GET_CURRENT_DIR_NAME)
|
||||
|
||||
88
ChangeLog
88
ChangeLog
@@ -1,10 +1,89 @@
|
||||
2.4.0 (2015-01-01) -
|
||||
2.4.2 (2015-03-15) -
|
||||
|
||||
- TW-41 Tasks in subprojects are not counted in project completion (thanks
|
||||
to Renato Alves).
|
||||
- TW-1450 Projects command should trigger running garbage collector (thanks to
|
||||
Tomas Babej).
|
||||
- TW-1535 move default listing-break from list to ls (thanks to David Patrick).
|
||||
- TW-1545 cc1plus: error: unrecognized command line option '-std=c++11' (thanks
|
||||
to Petteri).
|
||||
- TW-1546 column type due.remaining breaks colors on due tasks (thanks to
|
||||
Renato Alves).
|
||||
- TW-1547 Recur column is always shown even if no recurring task is displayed
|
||||
(thanks to Renato Alves).
|
||||
- TW-1549 task annotate hangs with specific text pattern (thanks to Alexandre
|
||||
de Verteuil).
|
||||
- TW-1550 _contexts helper-command (thanks to David Patrick).
|
||||
- TW-1551 Unable to get a UDA value from DOM (thanks to Tomas Babej).
|
||||
- Eliminated some code that is not UTF8-safe.
|
||||
- Removed pthreads linkage.
|
||||
- Implemented the context feature.
|
||||
- Closed dangling pipes in execute (), resolving problems when a hook script
|
||||
forks (thanks to Jens Erat).
|
||||
- Re-enabled hook script feedback when exiting with 0 exit status.
|
||||
- The 'info' command now shows virtual tags.
|
||||
- Fixed major on-modify hooks regression where hooks could no longer modify
|
||||
the tasks handed to them.
|
||||
- 'task _version' now outputs "2.4.2 (git-ref)" when built from git. "2.4.2"
|
||||
when built from release tarballs (thanks to Renato Alves).
|
||||
|
||||
------ current release ---------------------------
|
||||
|
||||
2.4.1 (2015-02-16) 82e019a4a8b20de63d53b51d59b8d1c89d3c05b2
|
||||
|
||||
- TW-1457 Non-existent attributes are not properly handled (thanks to Tomas
|
||||
Babej).
|
||||
- TW-1484 The 'history' and 'ghistory' reports do not obey rc.color.label.
|
||||
- TW-1486 task wait shows completed tasks which has a wait attribute (thanks to
|
||||
Sujeevan Vijayakumaran).
|
||||
- TW-1487 Task export exports some numeric attributes as strings (thanks to
|
||||
Tomas Babej).
|
||||
- TW-1491 Regression in deleting due dates (thanks to Jens Erat).
|
||||
- TW-1492 compiling v2.4.0 using musl(libc) (thanks to V.Krishn).
|
||||
- TW-1495 German translation for taskwarrior (thanks to Jens Erat).
|
||||
- TW-1498 Filtering for presence of UDA matches all tasks (thanks to Ralph
|
||||
Bean).
|
||||
- TW-1501 Calc can't handle multi-digit numbers in some expressions (thanks to
|
||||
Jeremy John Reeder).
|
||||
- TW-1502 Successful on-add hook with no output confuses TW (thanks to Tomas
|
||||
Babej).
|
||||
- TW-1504 On-modify hook does not accept correct JSON format (thanks to Tomas
|
||||
Babej).
|
||||
- TW-1505 completely ignore mis-named hook scripts (thanks to Tomas Babej,
|
||||
David Patrick).
|
||||
- TW-1509 Hooks modifications performed on sync not sycning back (thanks to
|
||||
Tomas Babej).
|
||||
- TW-1510 Task can save empty value in the data backlog (thanks to Tomas Babej).
|
||||
- TW-1517 Hook performance should be measured individually for each hook (thanks
|
||||
to Tomas Babej).
|
||||
- TW-1518 Misbehaving hooks silently break task processing (thanks to Wim
|
||||
Schuermann).
|
||||
- TW-1519 Testing suite forces taskd.trust="ignore hostname" (thanks to Renato
|
||||
Alves).
|
||||
- TW-1522 Date format doesn't like hyphens (thanks to Scott Carter).
|
||||
- TW-1524 Build Broken (thanks to Jack).
|
||||
- TW-1530 Multiple on-add hooks generating new tasks are ignored (thanks to
|
||||
Tomas Babej).
|
||||
- TW-1531 'task export' should handle recurrence (thanks to Tomas Babej).
|
||||
- TW-1532 Hooks does not execute any script on Cygwin (thanks to Taisuke
|
||||
Hachimura).
|
||||
- TW-1534 Urgency coefficient for user project disables 'info' output (thanks to
|
||||
Martin).
|
||||
- TW-1542 Large numeric UDA values get rendered in scientific notation on export
|
||||
(thanks to Ralph Bean).
|
||||
- Fixed assorted color theme problems.
|
||||
- Changed assorted reports so they do not use '.age' format for dates that are
|
||||
in the future, because those are never shown with this format (thanks to
|
||||
Sujeevan Vijayakumaran).
|
||||
- New 'recurrence' configuration setting can disable recurring task generation.
|
||||
|
||||
2.4.0 (2015-01-01) 670102842c39bdc62ef84ae4b679a8f5a2d89523
|
||||
|
||||
- TD-42 Cannot compile taskd - GNUTLS_VERSION undefined in diag.cpp (thanks
|
||||
to Michele Vetturi).
|
||||
- TD-45 Fix preprocessor define (thanks to Jochen Sprickerhof).
|
||||
- TD-55 TLSServer/Client need to include <errno.h> on Solaris (thanks to Tatjana
|
||||
Heuser). Also applied to NetBSD.
|
||||
- TD-55 TLSServer/Client need to include <errno.h> on Solaris (thanks to
|
||||
Tatjana Heuser). Also applied to NetBSD.
|
||||
- TD-56 File.cpp needs to include <string.h> on Solaris (thanks to Tatjana
|
||||
Heuѕer).
|
||||
- TD-57 taskdctl script assumes /bin/sh is /bin/bash (thanks to Tatjana Heuser).
|
||||
@@ -45,6 +124,7 @@
|
||||
- TW-52 "task add ... recur:2 months" interpreted as "2s" (thanks to jwhisnant).
|
||||
- TW-55 Bulk edit recurring tasks without answering yes/no for each? (thanks to
|
||||
Max Muller).
|
||||
- TW-63 indicators for UDAs (thanks to David Patrick).
|
||||
- TW-71 task ls/list/long/etc. should match contents of projects too (thanks to
|
||||
Cory Donnelly).
|
||||
- TW-72 extend info report with urgency column.
|
||||
@@ -286,8 +366,6 @@
|
||||
- Supports 'debug.parser' configuration setting.
|
||||
- Supports 'color.label.sort' for column labels of sort columns.
|
||||
|
||||
------ current release ---------------------------
|
||||
|
||||
2.3.0 (2014-01-15) c4eb46507031b7dee839dcb932bb2a22b2f0d3a2
|
||||
|
||||
Features
|
||||
|
||||
23
DEVELOPER
23
DEVELOPER
@@ -1,9 +1,16 @@
|
||||
How to Build Taskwarrior
|
||||
|
||||
Satisfy the Requirements:
|
||||
- gcc 4.4 or later, clang 2.9 or later or equivalent. This is because 2.4.1
|
||||
marks the first step towards using modern C++11. Initially this involves
|
||||
only feature N1984.
|
||||
- libuuid
|
||||
- gnutls (optional)
|
||||
|
||||
Obtain and build code:
|
||||
$ git clone https://git.tasktools.org/scm/tm/task.git task.git
|
||||
$ cd task.git
|
||||
$ git checkout 2.4.0 # Latest dev branch
|
||||
$ git checkout 2.4.2 # Latest dev branch
|
||||
$ cmake -DCMAKE_BUILD_TYPE=debug . # debug or release. Default: neither.
|
||||
$ make VERBOSE=1 # Shows details
|
||||
|
||||
@@ -18,8 +25,9 @@ How to Build Taskwarrior
|
||||
current development branch. The source tarballs do not reflect HEAD, and do
|
||||
not contain the test suite.
|
||||
|
||||
If you send us a patch, make sure that patch is made against git HEAD. We
|
||||
cannot apply patches made against the tarball source.
|
||||
If you send a patch (support@taskwarrior.org), make sure that patch is made
|
||||
against git HEAD on the development branch. We cannot apply patches made
|
||||
against the tarball source, or master.
|
||||
|
||||
General Statement
|
||||
This file is intended to convey the current efforts, priorities and needs of
|
||||
@@ -181,12 +189,11 @@ Work in Progress
|
||||
Current Codebase Condition
|
||||
|
||||
'master' branch:
|
||||
- 2.3.0 Current release, locked.
|
||||
- 2.4.1 Current release, locked.
|
||||
|
||||
'2.4.0' branch:
|
||||
- Current development branch with new command line parser, expressions,
|
||||
and heading for beta soon.
|
||||
'2.4.2' branch:
|
||||
- Current development branch no plans yet.
|
||||
|
||||
---
|
||||
|
||||
2014-10-12 Updated for 2.4.0
|
||||
2015-02-14 Updated for 2.4.1
|
||||
|
||||
@@ -24,7 +24,7 @@ Command Line Parsing
|
||||
determines whether subsequent arguments are interpreted as part of a filter or
|
||||
set of modifications.
|
||||
|
||||
The Parser object is fed command line arguments, then through a succession of
|
||||
The CLI object is fed command line arguments, then through a succession of
|
||||
calls builds and annotates a parse tree. To help with this, the Lexer is
|
||||
used to break up strings into tokens.
|
||||
|
||||
|
||||
20
INSTALL
20
INSTALL
@@ -8,9 +8,17 @@ Pre-requisites
|
||||
--------------
|
||||
|
||||
You will need the CMake build system installed in order to build taskwarrior
|
||||
from source.
|
||||
from source. More information on cmake can be obtained at http://cmake.org
|
||||
|
||||
More information on cmake can be obtained at http://cmake.org
|
||||
You will need a C++ compiler that supports C++11 N1984, which includes:
|
||||
|
||||
- gcc 4.4 (released 2009-04-21)
|
||||
- clang 2.9 (released 2011-04-06)
|
||||
|
||||
In addition:
|
||||
|
||||
- uuid lib
|
||||
- gnutls (optional - for syncing)
|
||||
|
||||
It is HIGHLY RECOMMENDED that you build with a library that provides uuid_*
|
||||
functions, such as libuuid.
|
||||
@@ -92,10 +100,12 @@ Currently the defined languages are:
|
||||
|
||||
eng_USA 1
|
||||
esp_ESP 2
|
||||
deu_DEU 3
|
||||
fra_FRA 4
|
||||
ita_ITA 5
|
||||
por_PRT 6
|
||||
|
||||
epo_RUS 7
|
||||
pol_POL 8
|
||||
|
||||
Uninstallation
|
||||
--------------
|
||||
@@ -131,9 +141,7 @@ Cygwin
|
||||
|
||||
|
||||
Darwin, 32bit
|
||||
The taskwarrior packages will not work on a 32-bit OSX installation on Core
|
||||
Duo hardware. You will need to build Taskwarrior from source, and use this
|
||||
configure command:
|
||||
Taskwarrior needs to be built from source, and use this configure command:
|
||||
|
||||
cmake -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_EXE_LINKER_FLAGS=-m32 .
|
||||
|
||||
|
||||
110
NEWS
110
NEWS
@@ -1,98 +1,50 @@
|
||||
|
||||
New Features in taskwarrior 2.4.0
|
||||
New Features in taskwarrior 2.4.2
|
||||
|
||||
- The 'show' command displays default configuration values, when appropriate.
|
||||
- Removed deprecated commands 'push', 'pull' and 'merge'.
|
||||
- Portuguese (por-PRT), French (fra-FRA), Esperanto (epo-RUS) and Polish
|
||||
(pol-POL) localizations.
|
||||
- Better handling for deletion of recurring tasks.
|
||||
- New virtual tags: YESTERDAY, TOMORROW, READY, PENDING, COMPLETED, DELETED,
|
||||
TAGGED.
|
||||
- The '_get' command properly uses exit codes.
|
||||
- Regular expressions are now enabled by default.
|
||||
- The 'filter' verbosity token shows the complete filter used for the last
|
||||
command.
|
||||
- The 'new-uuid' verbosity token shows the UUID of newly created tasks.
|
||||
- The 'info' report now breaks down urgency values.
|
||||
- New 'color.until' color rule.
|
||||
- Using a non-zero 'urgency.inherit.coefficient' value means a task inherits
|
||||
the urgency values of the dependency chain.
|
||||
- Listing breaks now supported. See 'man taskrc'.
|
||||
- New fish shell completion script.
|
||||
- The filter form 'name:value' now maps to the partial match operator '=',
|
||||
rather than the exact match operator, '=='. This means that dates now
|
||||
match on the day by default, not the time also.
|
||||
- UDA indicator format.
|
||||
- Hooks.
|
||||
- New and updated holidays.rc files.
|
||||
- Ability to set context, which serves as a permanent user-defined filter.
|
||||
- The 'info' command now shows virtual tags.
|
||||
|
||||
New commands in taskwarrior 2.4.0
|
||||
New commands in taskwarrior 2.4.2
|
||||
|
||||
- New 'calc' command (and standalone utility) for quick command line
|
||||
calculations.
|
||||
- The 'context' command has been added, along with it subcommands 'define',
|
||||
'delete', 'show', 'list' and 'none'.
|
||||
|
||||
New configuration options in taskwarrior 2.4.0
|
||||
New configuration options in taskwarrior 2.4.2
|
||||
|
||||
- The 'taskd.trust' setting is now a tri-state, supporting values 'strict',
|
||||
'ignore hostname' and 'allow all', for server certificate validation.
|
||||
- New theme: dark-gray-blue-256.theme
|
||||
- The 'allow.empty.filter' setting can be set to 'no' to disallow the
|
||||
potentially dangerous combination of write commands and empty filters.
|
||||
- New truncated_count column style for the description field which as the
|
||||
name says is a combination of the existing truncated and count styles.
|
||||
- New 'hooks' setting is a master control switch for hook processing.
|
||||
- New 'debug.hooks' for debugging hook scripts.
|
||||
- New 'debug.parser' for debugging parser issues scripts.
|
||||
- New 'color.label.sort' is used to color the column label of sort columns.
|
||||
- New 'urgency.uda.<name>.<value>' allows specific UDA values to affect
|
||||
urgency.
|
||||
- New 'recurrence.confirmation' which allows bypassing confirmation for
|
||||
changes to recurring tasks, by accepting, rejecting or prompting.
|
||||
- New 'uda.<name>.indicator' to override the UDA indicator.
|
||||
- 'context' to store the current context applied.
|
||||
- 'context.<name>' to store the definition of context 'name'
|
||||
|
||||
Newly deprecated features in taskwarrior 2.4.0
|
||||
Newly deprecated features in taskwarrior 2.4.2
|
||||
|
||||
- The alias '_query' is deprecated.
|
||||
- Bare word search terms are deprecated, so 'task pattern list' will not
|
||||
be supported in future releases, instead requiring 'task /pattern/ list'.
|
||||
- The 'limit' pseudo attribute will change to 'rc.limit' in a future release.
|
||||
- None
|
||||
|
||||
Removed features in 2.4.0
|
||||
Removed features in 2.4.2
|
||||
|
||||
- Version 1.x column names no longer supported.
|
||||
- Version 1.x sort columns no longer supported.
|
||||
- Old-style color names including underscores are no longer supported.
|
||||
- Removed priority counts from the 'projects' commands.
|
||||
- Removed the unused 'locale' configuration variable.
|
||||
- Removed the unused 'patterns' confguration variable.
|
||||
- Removed the obsolete 'task-faq.5' man page.
|
||||
- Removed the obsolete 'task-tutorial.5' man page.
|
||||
- Removed the obsolete 'tasksh.1' man page.
|
||||
- Removed the 'tasksh' program from the Taskwarrior distribution. It is now
|
||||
a separate project.
|
||||
- Removed the 'complete.all.projects' setting that was not used.
|
||||
- Removed support for 'report.X.limit', which can now be set in the report
|
||||
filter 'limit:N'.
|
||||
- The 'total active time' information is removed from the 'info' report.
|
||||
This was being misinterpreted as support for time tracking.
|
||||
- The 'shadow file' feature is removed, but replaced with an example hook
|
||||
script that performs the same function..
|
||||
- None
|
||||
|
||||
Known Issues
|
||||
|
||||
- On Cygwin, case-insensitive regex searches are broken. The default is
|
||||
now case-sensitive for Cygwin only.
|
||||
- https://bug.tasktools.org
|
||||
- If you upgraded from Taskwarrior 2.3.0, you will need one of the following
|
||||
settings to allow continued syncing to a Taskserver:
|
||||
|
||||
$ task config taskd.trust strict
|
||||
$ task config taskd.trust 'ignore hostname'
|
||||
$ task config taskd.trust 'allow all'
|
||||
|
||||
These are presented in order of preference from most to least secure, and
|
||||
depend on how your certs were generated.
|
||||
|
||||
- https://bug.tasktools.org/
|
||||
|
||||
Taskwarrior has been built and tested on the following configurations:
|
||||
|
||||
* OS X 10.10 Yosemite, 10.9 Mavericks
|
||||
* Fedora 20 Heisenbug
|
||||
* Ubuntu 14.04 Trusty Tahr
|
||||
* Debian 7.0 Wheezy (stable)
|
||||
* Arch 2014.05
|
||||
* FreeBSD 10
|
||||
* Cygwin 1.7.29, 1.7.32
|
||||
* OS X
|
||||
* Fedora
|
||||
* Ubuntu
|
||||
* Debian
|
||||
* Arch
|
||||
* FreeBSD
|
||||
* Cygwin
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH task-color 5 2015-01-01 "${PACKAGE_STRING}" "User Manuals"
|
||||
.TH task-color 5 2015-03-15 "${PACKAGE_STRING}" "User Manuals"
|
||||
|
||||
.SH NAME
|
||||
task-color \- A color tutorial for the taskwarrior command line todo manager.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH task-sync 5 2015-01-01 "${PACKAGE_STRING}" "User Manuals"
|
||||
.TH task-sync 5 2015-03-15 "${PACKAGE_STRING}" "User Manuals"
|
||||
|
||||
.SH NAME
|
||||
task-sync \- A discussion and tutorial for the various task(1) data
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH task 1 2015-01-01 "${PACKAGE_STRING}" "User Manuals"
|
||||
.TH task 1 2015-03-15 "${PACKAGE_STRING}" "User Manuals"
|
||||
|
||||
.SH NAME
|
||||
task \- A command line todo manager.
|
||||
@@ -396,6 +396,46 @@ Finally, this command removes any 'name=...' entry from the .taskrc file:
|
||||
|
||||
task config name
|
||||
|
||||
.TP
|
||||
.B task context <name>
|
||||
Sets the currectly active context. See the CONTEXT section.
|
||||
|
||||
Example:
|
||||
|
||||
task context work
|
||||
|
||||
.TP
|
||||
.B task context delete <name>
|
||||
Deletes the context with the name <name>. If the context being deleted is currently
|
||||
set as active, it will be unset.
|
||||
|
||||
Example:
|
||||
|
||||
task context delete work
|
||||
|
||||
.TP
|
||||
.B task context define <name> <filter>
|
||||
Defines a new context with name <name> and definition <filter>. This command
|
||||
does not affect the currently set context, just adds a new context definition.
|
||||
|
||||
Examples:
|
||||
|
||||
task context define work project:Work
|
||||
task context define home project:Home or +home
|
||||
task context define superurgent due:today and +urgent
|
||||
|
||||
.TP
|
||||
.B task context list
|
||||
Outputs a list of available contexts along with their definitions.
|
||||
|
||||
.TP
|
||||
.B task context none
|
||||
Unsets the currently active context, if any was set.
|
||||
|
||||
.TP
|
||||
.B task context show
|
||||
Shows the currently active context, along with its definition.
|
||||
|
||||
.TP
|
||||
.B task diagnostics
|
||||
Shows diagnostic information, of the kind needed when reporting a problem.
|
||||
@@ -474,6 +514,10 @@ Generates a list of all commands, for autocompletion purposes.
|
||||
.B task _config
|
||||
Lists all supported configuration variables, for completion purposes.
|
||||
|
||||
.TP
|
||||
.B task _context
|
||||
Lists all available context variables, for completion purposes.
|
||||
|
||||
.TP
|
||||
.B task <filter> _ids
|
||||
Shows only the IDs of matching tasks, in the form of a list.
|
||||
@@ -962,6 +1006,66 @@ biannual, biyearly, 2yr
|
||||
Every two years.
|
||||
.RE
|
||||
|
||||
.SH CONTEXT
|
||||
Context is a user-defined filter, which is automatically applied to all commands
|
||||
that filter the task list. In particular, any report command will have its
|
||||
result affected by the current active context.
|
||||
|
||||
$ task list
|
||||
ID Age Project Description Urg
|
||||
1 2d Sport Run 5 miles 1.42
|
||||
2 1d Home Clean the dishes 1.14
|
||||
|
||||
$ task context home
|
||||
Context 'home' set. Use 'task context none' to remove.
|
||||
|
||||
$ task list
|
||||
ID Age Project Description Urg
|
||||
2 1d Home Clean the dishes 1.14
|
||||
Context 'home' set. Use 'task context none' to remove.
|
||||
|
||||
As seen in the example above, context is applied by specifying its name to the
|
||||
"context" command. To change the currently applied context, just pass the
|
||||
new context's name to the 'context' command.
|
||||
|
||||
To unset any context, use the 'none' subcommand.
|
||||
|
||||
$ task context none
|
||||
Context unset.
|
||||
|
||||
$ task list
|
||||
ID Age Project Description Urg
|
||||
1 2d Sport Run 5 miles 1.42
|
||||
2 1d Home Clean the dishes 1.14
|
||||
|
||||
Context can be defined using the 'define' subcommand, specifying both the name
|
||||
of the new context, and it's assigned filter.
|
||||
|
||||
$ task context define home
|
||||
Are you sure you want to add 'context.home' with a value of 'project:Home'? (yes/no) yes
|
||||
Context 'home' successfully defined.
|
||||
|
||||
To remove the definition, use the 'delete' subcommand.
|
||||
|
||||
$ task context delete home
|
||||
Are you sure you want to remove 'context.home'? (yes/no) yes
|
||||
Context 'home' successfully undefined.
|
||||
|
||||
To check what is the currently active context, use the 'show' subcommand.
|
||||
|
||||
$ task context show
|
||||
Context 'home' with filter 'project:Home' is currently applied.
|
||||
|
||||
Contexts can store arbitrarily complex filters.
|
||||
|
||||
$ task context define family project:Family or +paul or +nancy
|
||||
Are you sure you want to add 'context.home' with a value of 'project:Family or +paul or +nancy'? (yes/no) yes
|
||||
Context 'family' successfully defined.
|
||||
|
||||
Contexts are permanent, and the currently set context name is stored in the
|
||||
"context" configuration variable. The context definition is stored in the
|
||||
"context.<name>" configuration variable.
|
||||
|
||||
.SH COMMAND ABBREVIATION
|
||||
All taskwarrior commands may be abbreviated as long as a unique prefix is used,
|
||||
for example:
|
||||
@@ -1057,11 +1161,11 @@ the 'data.location' configuration setting of the task data directory.
|
||||
For examples please see the online documentation starting at
|
||||
|
||||
.RS
|
||||
<http://taskwarrior.org/projects/taskwarrior/wiki>
|
||||
<http://taskwarrior.org/docs>
|
||||
.RE
|
||||
|
||||
Note that the online documentation is more detailed and more current than this
|
||||
man page.
|
||||
Note that the online documentation can be more detailed and more current than
|
||||
this man page.
|
||||
|
||||
.SH FILES
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH taskrc 5 2015-01-01 "${PACKAGE_STRING}" "User Manuals"
|
||||
.TH taskrc 5 2015-03-15 "${PACKAGE_STRING}" "User Manuals"
|
||||
|
||||
.SH NAME
|
||||
taskrc \- Configuration details for the task(1) command
|
||||
@@ -282,9 +282,8 @@ and project. The others are sent to standard output.
|
||||
.TP
|
||||
.B confirmation=yes
|
||||
May be "yes" or "no", and determines whether taskwarrior will ask for
|
||||
confirmation before deleting a task, performing bulk changes, or the undo
|
||||
command. The default value is "yes". Consider leaving this setting as "yes",
|
||||
for safety.
|
||||
confirmation before deleting a task or performing the undo command. The default
|
||||
value is "yes". Consider leaving this setting as "yes", for safety.
|
||||
|
||||
.TP
|
||||
.B allow.empty.filter=yes
|
||||
@@ -313,9 +312,9 @@ Controls padding between columns of the report output. Default is "1".
|
||||
.TP
|
||||
.B bulk=3
|
||||
Is a number, defaulting to 3. When this number or greater of tasks are modified
|
||||
in a single command, confirmation will be required, unless the
|
||||
in a single command, confirmation will be required, regardless of the value of
|
||||
.B confirmation
|
||||
variable is "no".
|
||||
variable.
|
||||
|
||||
This is useful for preventing large-scale unintended changes.
|
||||
|
||||
@@ -412,6 +411,11 @@ The character or string to show in the depends.indicator column. Defaults to +.
|
||||
.B uda.<name>.indicator=U
|
||||
The character or string to show in the <uda>.indicator column. Defaults to U.
|
||||
|
||||
.TP
|
||||
.B recurrence=yes
|
||||
Controls whether recurrence is enable, and whether recurring tasks continue to
|
||||
generate new task instances. Defaults to 'yes'.
|
||||
|
||||
.TP
|
||||
.B recurrence.confirmation=prompt
|
||||
Controls whether changes to recurring tasks propagates to other child tasks with
|
||||
@@ -616,6 +620,10 @@ field that is set. Otherwise, they are set to the corresponding values of
|
||||
.RE
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.B date.iso=yes
|
||||
Enables ISO-8601 date support. The default value is "yes".
|
||||
|
||||
.TP
|
||||
.B weekstart=Sunday
|
||||
Determines the day a week starts. Valid values are Sunday or Monday only. The
|
||||
@@ -1343,6 +1351,26 @@ of a task.
|
||||
.B uda.estimate.values=trivial,small,medium,large,huge
|
||||
.RE
|
||||
|
||||
.SS CONTEXT
|
||||
Context setting is a mechanism which allows the user to set a permanent filter,
|
||||
thus avoiding the need to specify one filter repeatedly. More details on usage
|
||||
can be found in the task(1) manpage.
|
||||
|
||||
The current context is stored in the taskrc file, along with definitions for
|
||||
all user provided contexts.
|
||||
|
||||
.TP
|
||||
.B context=<name>
|
||||
.RS
|
||||
Stores the value of the currently active context.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.B context.<name>=<filter>
|
||||
.RS
|
||||
Stores the definition of the context with the name <name>.
|
||||
.RE
|
||||
|
||||
.SS SYNC
|
||||
|
||||
These configuration settings are used to connect and sync tasks with the task
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
Themes
|
||||
|
||||
To generate samples of themes, first execute the 'run' script to generate the
|
||||
To generate samples of themes, first execute the 'setup' script to generate the
|
||||
sample data. Note that this data may need to be tweaked to include qualities
|
||||
that need to be illustrated in theme sample.
|
||||
|
||||
Then edit the 'rc' file to include the desired theme file.
|
||||
Using a dark-background terminal (black recommended), run the following:
|
||||
|
||||
Then run 'per' to run a few commands for each theme.
|
||||
run.dark
|
||||
|
||||
Note that this will require that the terminal window be switched between a black
|
||||
and white background to properly show the light and dark themes.
|
||||
Using a light-background terminal, run the following:
|
||||
|
||||
run.light
|
||||
|
||||
Using a solarized dark terminal, run the following:
|
||||
|
||||
run.solar.dark
|
||||
|
||||
Using a solarized light terminal, run the following:
|
||||
|
||||
run.solar.light
|
||||
|
||||
Note that for the solarized themes, the terminal color palette needs to be set
|
||||
to specific colors.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
|
||||
for theme in $PWD/../../rc/*.theme
|
||||
do
|
||||
cat <<EOF >>x
|
||||
data.location=.
|
||||
confirmation=off
|
||||
_forcecolor=on
|
||||
include $theme
|
||||
EOF
|
||||
|
||||
echo "--- $theme -----------------------------------------------------"
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
task rc:x summary
|
||||
echo '$ task ghistory'
|
||||
task rc:x ghistory
|
||||
echo '$ task calendar'
|
||||
task rc:x calendar
|
||||
echo '$ task burndown.daily'
|
||||
task rc:x burndown.daily
|
||||
done
|
||||
@@ -21,6 +21,8 @@ include $theme
|
||||
EOF
|
||||
|
||||
echo "--- $theme -----------------------------------------------------"
|
||||
echo '$ task color legend'
|
||||
task rc:x color legend
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
|
||||
24
doc/misc/themes/run.default
Executable file
24
doc/misc/themes/run.default
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat <<EOF >x
|
||||
data.location=.
|
||||
confirmation=off
|
||||
detection=off
|
||||
_forcecolor=on
|
||||
default.height=24
|
||||
verbose=off
|
||||
EOF
|
||||
|
||||
echo "--- DEFAULT -----------------------------------------------------"
|
||||
echo '$ task color legend'
|
||||
task rc:x color legend
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
task rc:x summary
|
||||
echo '$ task ghistory'
|
||||
task rc:x ghistory
|
||||
echo '$ task calendar'
|
||||
task rc:x calendar
|
||||
echo '$ task burndown.daily'
|
||||
task rc:x burndown.daily
|
||||
@@ -14,6 +14,8 @@ include $theme
|
||||
EOF
|
||||
|
||||
echo "--- $theme -----------------------------------------------------"
|
||||
echo '$ task color legend'
|
||||
task rc:x color legend
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
|
||||
@@ -13,6 +13,8 @@ include $theme
|
||||
EOF
|
||||
|
||||
echo "--- $theme -----------------------------------------------------"
|
||||
echo '$ task color legend'
|
||||
task rc:x color legend
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
|
||||
@@ -13,6 +13,8 @@ include $theme
|
||||
EOF
|
||||
|
||||
echo "--- $theme -----------------------------------------------------"
|
||||
echo '$ task color legend'
|
||||
task rc:x color legend
|
||||
echo '$ task list'
|
||||
task rc:x list
|
||||
echo '$ task summary'
|
||||
|
||||
@@ -33,15 +33,15 @@ color.alternate=
|
||||
color.header=yellow
|
||||
color.footnote=yellow
|
||||
color.warning=bold red
|
||||
color.error=yellow
|
||||
color.debug=yellow
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=green on white
|
||||
color.deleted=red on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=black on bright green
|
||||
color.recurring=magenta
|
||||
color.scheduled=on green
|
||||
color.scheduled=white on green
|
||||
color.until=
|
||||
color.blocked=black on white
|
||||
color.blocking=black on bright white
|
||||
|
||||
@@ -29,22 +29,22 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray1
|
||||
color.alternate=on gray2
|
||||
color.header=color3
|
||||
color.footnote=color3
|
||||
color.warning=bold red
|
||||
color.error=color3
|
||||
color.debug=color3
|
||||
color.error=white on red
|
||||
color.debug=color4
|
||||
|
||||
# Task state
|
||||
color.completed=rgb010 on white
|
||||
color.deleted=rgb100 on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb555 on rgb410
|
||||
color.recurring=rgb013
|
||||
color.scheduled=on rgb001
|
||||
color.until=
|
||||
color.blocked=white on color8
|
||||
color.blocking=white on color15
|
||||
color.blocking=black on color15
|
||||
|
||||
# Project
|
||||
color.project.none=
|
||||
|
||||
@@ -29,19 +29,19 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray1
|
||||
color.alternate=on gray2
|
||||
color.header=rgb013
|
||||
color.footnote=rgb013
|
||||
color.warning=bold red
|
||||
color.error=rgb013
|
||||
color.error=white on red
|
||||
color.debug=rgb013
|
||||
|
||||
# Task state
|
||||
color.completed=rgb001 on white
|
||||
color.deleted=rgb100 on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb045 on rgb015
|
||||
color.recurring=rgb115
|
||||
color.scheduled=on rgb011
|
||||
color.scheduled=on rgb012
|
||||
color.until=
|
||||
color.blocked=white on rgb001
|
||||
color.blocking=white on rgb002
|
||||
@@ -76,8 +76,8 @@ color.history.delete=color0 on rgb035
|
||||
color.history.done=color0 on rgb025
|
||||
|
||||
# Report: summary
|
||||
color.summary.background=white on color0
|
||||
color.summary.bar=white on rgb003
|
||||
color.summary.background=on rgb001
|
||||
color.summary.bar=on rgb114
|
||||
|
||||
# Command: calendar
|
||||
color.calendar.due.today=color0 on color252
|
||||
|
||||
@@ -29,16 +29,16 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray1
|
||||
color.alternate=on gray2
|
||||
color.header=color0 on gray11
|
||||
color.footnote=on gray5
|
||||
color.warning=bold red
|
||||
color.error=red on white
|
||||
color.debug=black on white
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=black on white
|
||||
color.deleted=black on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=black on gray18
|
||||
color.recurring=
|
||||
color.scheduled=on gray8
|
||||
@@ -61,7 +61,7 @@ color.tag.none=
|
||||
color.tagged=
|
||||
|
||||
# Due
|
||||
color.due=on gray2
|
||||
color.due=on gray3
|
||||
color.due.today=on gray4
|
||||
color.overdue=on gray6
|
||||
|
||||
@@ -76,12 +76,12 @@ color.history.delete=black on gray10
|
||||
color.history.done=gray5 on gray23
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=on gray15
|
||||
color.summary.background=on black
|
||||
color.summary.bar=on gray12
|
||||
color.summary.background=on gray5
|
||||
|
||||
# Command: calendar
|
||||
color.calendar.due=on gray8
|
||||
color.calendar.due.today=on gray15
|
||||
color.calendar.due.today=black on gray15
|
||||
color.calendar.holiday=black on gray20
|
||||
color.calendar.overdue=gray2 on gray10
|
||||
color.calendar.today=bold white
|
||||
@@ -89,7 +89,7 @@ color.calendar.weekend=on gray2
|
||||
color.calendar.weeknumber=gray6
|
||||
|
||||
# Command: sync
|
||||
color.sync.add=gray15 on gray5
|
||||
color.sync.added=gray15 on gray5
|
||||
color.sync.changed=black on gray10
|
||||
color.sync.rejected=gray5 on gray23
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray0
|
||||
color.alternate=on gray2
|
||||
color.header=gray10
|
||||
color.footnote=gray10
|
||||
color.warning=
|
||||
color.error=rgb500
|
||||
color.debug=rgb500
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=
|
||||
@@ -44,7 +44,7 @@ color.recurring=
|
||||
color.scheduled=
|
||||
color.until=
|
||||
color.blocked=bold gray10 on gray4
|
||||
color.blocking=bold gray18 on gray6
|
||||
color.blocking=gray18 on gray6
|
||||
|
||||
# Project
|
||||
color.project.none=
|
||||
@@ -66,18 +66,18 @@ color.due.today=color0 on rgb024
|
||||
color.overdue=color0 on rgb035
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.pending=on gray9
|
||||
color.burndown.started=on gray16
|
||||
color.burndown.done=on rgb013
|
||||
color.burndown.pending=white on gray9
|
||||
color.burndown.started=black on gray16
|
||||
color.burndown.done=white on rgb013
|
||||
|
||||
# Report: history
|
||||
color.history.add=on gray9
|
||||
color.history.delete=black on gray23
|
||||
color.history.done=black on rgb013
|
||||
color.history.add=white on gray6
|
||||
color.history.delete=black on gray18
|
||||
color.history.done=black on rgb024
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=on rgb012
|
||||
color.summary.background=on color0
|
||||
color.summary.background=on gray2
|
||||
|
||||
# Command: calendar
|
||||
color.calendar.due=color0 on gray10
|
||||
@@ -94,6 +94,6 @@ color.sync.changed=gray15
|
||||
color.sync.rejected=gray23
|
||||
|
||||
# Command: undo
|
||||
color.undo.before=green
|
||||
color.undo.after=red
|
||||
color.undo.before=rgb013
|
||||
color.undo.after=rgb035
|
||||
|
||||
|
||||
@@ -29,19 +29,19 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray1
|
||||
color.alternate=on gray2
|
||||
color.header=rgb031
|
||||
color.footnote=rgb031
|
||||
color.warning=bold red
|
||||
color.error=rgb031
|
||||
color.debug=rgb031
|
||||
color.warning=rgb020
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=rgb020 on white
|
||||
color.deleted=rgb200 on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb050 on rgb010
|
||||
color.recurring=rgb151
|
||||
color.scheduled=on rgb011
|
||||
color.scheduled=black on rgb031
|
||||
color.until=
|
||||
color.blocked=white on rgb010
|
||||
color.blocking=white on rgb020
|
||||
@@ -76,7 +76,7 @@ color.history.delete=color0 on rgb050
|
||||
color.history.done=color0 on rgb030
|
||||
|
||||
# Report: summary
|
||||
color.summary.background=white on color0
|
||||
color.summary.background=white on gray3
|
||||
color.summary.bar=white on rgb030
|
||||
|
||||
# Command: calendar
|
||||
@@ -95,4 +95,4 @@ color.sync.rejected=rgb010
|
||||
|
||||
# Command: undo
|
||||
color.undo.after=rgb053
|
||||
color.undo.before=rgb031
|
||||
color.undo.before=rgb021
|
||||
|
||||
@@ -29,19 +29,19 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on gray1
|
||||
color.alternate=on gray2
|
||||
color.header=rgb100
|
||||
color.footnote=rgb100
|
||||
color.warning=bold red
|
||||
color.error=rgb100
|
||||
color.debug=rgb100
|
||||
color.warning=red
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=rgb020 on white
|
||||
color.deleted=rgb200 on white
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb500 on rgb100
|
||||
color.recurring=rgb511
|
||||
color.scheduled=on rgb201
|
||||
color.scheduled=white on rgb311
|
||||
color.until=
|
||||
color.blocked=white on rgb100
|
||||
color.blocking=white on rgb200
|
||||
@@ -56,7 +56,7 @@ color.pri.M=rgb400
|
||||
color.pri.none=
|
||||
|
||||
# Tags
|
||||
color.tag.next=rgb440
|
||||
color.tag.next=rgb511
|
||||
color.tag.none=
|
||||
color.tagged=color246
|
||||
|
||||
@@ -94,6 +94,6 @@ color.sync.changed=rgb411
|
||||
color.sync.rejected=rgb200
|
||||
|
||||
# Command: undo
|
||||
color.undo.after=rgb503
|
||||
color.undo.before=rgb301
|
||||
color.undo.after=rgb511
|
||||
color.undo.before=rgb200
|
||||
|
||||
|
||||
@@ -33,15 +33,15 @@ color.alternate=on gray2
|
||||
color.header=rgb013
|
||||
color.footnote=rgb013
|
||||
color.warning=
|
||||
color.error=rgb013
|
||||
color.debug=rgb013
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb445 on rgb213
|
||||
color.recurring=rgb115
|
||||
color.scheduled=
|
||||
color.scheduled=white on rgb113
|
||||
color.until=
|
||||
color.blocked=white on rgb101
|
||||
color.blocking=white on rgb202
|
||||
@@ -61,9 +61,9 @@ color.tag.none=
|
||||
color.tagged=rgb334
|
||||
|
||||
# Due
|
||||
color.due=rgb055
|
||||
color.due.today=rgb533
|
||||
color.overdue=color9
|
||||
color.due=rgb015
|
||||
color.due.today=rgb125
|
||||
color.overdue=color5
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.pending=on rgb103
|
||||
@@ -76,14 +76,14 @@ color.history.done=color0 on rgb205
|
||||
color.history.delete=color0 on rgb305
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=white on rgb103
|
||||
color.summary.background=white on color0
|
||||
color.summary.bar=white on rgb104
|
||||
color.summary.background=white on rgb001
|
||||
|
||||
# Command: calendar
|
||||
color.calendar.due=color0 on rgb325
|
||||
color.calendar.due.today=color0 on rgb404
|
||||
color.calendar.holiday=color15 on rgb022
|
||||
color.calendar.overdue=color0 on color9
|
||||
color.calendar.holiday=color15 on rgb102
|
||||
color.calendar.overdue=color0 on color5
|
||||
color.calendar.today=color15 on rgb103
|
||||
color.calendar.weekend=gray12 on gray3
|
||||
color.calendar.weeknumber=rgb104
|
||||
|
||||
@@ -33,15 +33,15 @@ color.alternate=on gray2
|
||||
color.header=rgb031
|
||||
color.footnote=rgb031
|
||||
color.warning=
|
||||
color.error=rgb031
|
||||
color.debug=rgb031
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb451 on rgb310
|
||||
color.active=rgb451 on rgb320
|
||||
color.recurring=rgb343
|
||||
color.scheduled=
|
||||
color.scheduled=black on rgb441
|
||||
color.until=
|
||||
color.blocked=white on rgb110
|
||||
color.blocking=white on rgb220
|
||||
@@ -61,9 +61,9 @@ color.tag.none=
|
||||
color.tagged=rgb342
|
||||
|
||||
# Due
|
||||
color.due=rgb420
|
||||
color.due.today=rgb410
|
||||
color.overdue=rgb400
|
||||
color.due=rgb440
|
||||
color.due.today=rgb430
|
||||
color.overdue=rgb420
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.pending=on rgb110
|
||||
@@ -71,19 +71,19 @@ color.burndown.started=on rgb430
|
||||
color.burndown.done=on gray4
|
||||
|
||||
# Report: history
|
||||
color.history.add=color0 on rgb010
|
||||
color.history.done=color0 on rgb030
|
||||
color.history.delete=color0 on rgb050
|
||||
color.history.add=color0 on rgb110
|
||||
color.history.done=color0 on rgb430
|
||||
color.history.delete=white on gray4
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=white on rgb030
|
||||
color.summary.background=white on color0
|
||||
color.summary.bar=white on rgb330
|
||||
color.summary.background=white on rgb110
|
||||
|
||||
# Command: calendar
|
||||
color.calendar.due=color0 on rgb430
|
||||
color.calendar.due.today=color0 on rgb410
|
||||
color.calendar.due=color0 on rgb440
|
||||
color.calendar.due.today=color0 on rgb430
|
||||
color.calendar.holiday=rgb151 on rgb020
|
||||
color.calendar.overdue=color0 on rgb400
|
||||
color.calendar.overdue=color0 on rgb420
|
||||
color.calendar.today=color15 on rgb110
|
||||
color.calendar.weekend=on color235
|
||||
color.calendar.weeknumber=rgb110
|
||||
@@ -94,6 +94,6 @@ color.sync.changed=rgb430
|
||||
color.sync.rejected=rgb110
|
||||
|
||||
# Command: undo
|
||||
color.undo.before=rgb031
|
||||
color.undo.after=rgb053
|
||||
color.undo.before=rgb021
|
||||
color.undo.after=rgb042
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ color.alternate=
|
||||
color.header=bold white on bright black
|
||||
color.footnote=bold cyan on bright black
|
||||
color.warning=bold red
|
||||
color.error=red on white
|
||||
color.debug=white on black
|
||||
color.error=white on red
|
||||
color.debug=blue
|
||||
|
||||
# Task state
|
||||
color.completed=green on black
|
||||
color.deleted=red on black
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=bold yellow on bright black
|
||||
color.recurring=
|
||||
color.scheduled=on bright cyan
|
||||
@@ -63,17 +63,17 @@ color.tagged=
|
||||
# Due
|
||||
color.due=on bright green
|
||||
color.due.today=on bright yellow
|
||||
color.overdue=on bright magenta
|
||||
color.overdue=on bright red
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.pending=on bright green
|
||||
color.burndown.pending=on bright red
|
||||
color.burndown.started=on bright yellow
|
||||
color.burndown.done=on green
|
||||
|
||||
# Report: history
|
||||
color.history.add=blue on bright yellow
|
||||
color.history.done=green on bright green
|
||||
color.history.delete=black on red
|
||||
color.history.add=black on bright red
|
||||
color.history.done=black on bright green
|
||||
color.history.delete=black on yellow
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=on bright green
|
||||
@@ -82,11 +82,11 @@ color.summary.background=on white
|
||||
# Command: calendar
|
||||
color.calendar.due=on bright green
|
||||
color.calendar.due.today=blue on bright yellow
|
||||
color.calendar.holiday=yellow
|
||||
color.calendar.overdue=on bright magenta
|
||||
color.calendar.holiday=on yellow
|
||||
color.calendar.overdue=on bright red
|
||||
color.calendar.today=blue
|
||||
color.calendar.weekend=on white
|
||||
color.calendar.weeknumber=white on bright black
|
||||
color.calendar.weeknumber=blue
|
||||
|
||||
# Command: sync
|
||||
color.sync.added=green
|
||||
|
||||
@@ -33,13 +33,13 @@ color.alternate=on gray22
|
||||
color.header=color15 on gray8
|
||||
color.footnote=on gray18
|
||||
color.warning=color9
|
||||
color.error=red on white
|
||||
color.debug=color7 on color0
|
||||
color.error=white on red
|
||||
color.debug=rgb025
|
||||
|
||||
# Task state
|
||||
color.completed=rgb353 on rgb000
|
||||
color.deleted=rgb533 on rgb000
|
||||
color.active=rgb420
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=rgb510
|
||||
color.recurring=
|
||||
color.scheduled=on rgb345
|
||||
color.until=
|
||||
@@ -53,7 +53,7 @@ color.project.none=
|
||||
color.pri.H=gray0
|
||||
color.pri.M=gray5
|
||||
color.pri.L=gray10
|
||||
color.pri.none=gray5
|
||||
color.pri.none=
|
||||
|
||||
# Tags
|
||||
color.tag.next=rgb420
|
||||
@@ -66,14 +66,14 @@ color.due.today=on rgb353
|
||||
color.overdue=on rgb544
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.pending=on rgb141
|
||||
color.burndown.started=on rgb440
|
||||
color.burndown.pending=on rgb411
|
||||
color.burndown.started=on rgb550
|
||||
color.burndown.done=on rgb151
|
||||
|
||||
# Report: history
|
||||
color.history.add=rgb005 on rgb440
|
||||
color.history.done=rgb020 on rgb343
|
||||
color.history.delete=rgb300 on rgb533
|
||||
color.history.add=color0 on rgb411
|
||||
color.history.done=color0 on rgb151
|
||||
color.history.delete=color0 on rgb550
|
||||
|
||||
# Report: summary
|
||||
color.summary.bar=on rgb141
|
||||
@@ -82,7 +82,7 @@ color.summary.background=on gray20
|
||||
# Command: calendar
|
||||
color.calendar.due=on rgb343
|
||||
color.calendar.due.today=on rgb353
|
||||
color.calendar.holiday=rgb420
|
||||
color.calendar.holiday=color0 on rgb530
|
||||
color.calendar.overdue=on rgb533
|
||||
color.calendar.today=rgb005
|
||||
color.calendar.weekend=on gray21
|
||||
|
||||
@@ -83,14 +83,14 @@ color.due.today=color1
|
||||
color.overdue=color5
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.done=color0 on color4
|
||||
color.burndown.done=color0 on color6
|
||||
color.burndown.pending=color0 on color1
|
||||
color.burndown.started=color0 on color9
|
||||
color.burndown.started=color0 on color3
|
||||
|
||||
# Report: history
|
||||
color.history.add=color0 on color1
|
||||
color.history.delete=color0 on color3
|
||||
color.history.done=color0 on color10
|
||||
color.history.done=color0 on color6
|
||||
|
||||
# Report: summary
|
||||
color.summary.background=on color0
|
||||
|
||||
@@ -46,7 +46,7 @@ rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overd
|
||||
# General decoration
|
||||
color.label=
|
||||
color.label.sort=
|
||||
color.alternate=on white #color7 (allows bold for alternate rows)
|
||||
color.alternate=on color7
|
||||
color.header=color2
|
||||
color.footnote=color2
|
||||
color.warning=
|
||||
@@ -56,20 +56,20 @@ color.debug=color3
|
||||
# Task state
|
||||
color.completed=
|
||||
color.deleted=
|
||||
color.active=bold red #color9
|
||||
color.active=color9
|
||||
color.recurring=color4
|
||||
color.scheduled=
|
||||
color.until=
|
||||
color.blocked=on color14
|
||||
color.blocking=on color14
|
||||
color.blocked=color0 on color14
|
||||
color.blocking=color15 on color0
|
||||
|
||||
# Project
|
||||
color.project.none=
|
||||
|
||||
# Priority
|
||||
color.pri.H=bold black #color0
|
||||
color.pri.M=bold yellow #color11
|
||||
color.pri.L=bold cyan #color14
|
||||
color.pri.H=bold color0
|
||||
color.pri.M=bold color11
|
||||
color.pri.L=bold color14
|
||||
color.pri.none=
|
||||
|
||||
# Tags
|
||||
@@ -83,14 +83,14 @@ color.due.today=color1
|
||||
color.overdue=color5
|
||||
|
||||
# Report: burndown
|
||||
color.burndown.done=color0 on color4
|
||||
color.burndown.done=color0 on color6
|
||||
color.burndown.pending=color0 on color1
|
||||
color.burndown.started=color0 on color9
|
||||
color.burndown.started=color0 on color3
|
||||
|
||||
# Report: history
|
||||
color.history.add=color0 on color1
|
||||
color.history.delete=color0 on color3
|
||||
color.history.done=color14 on color0
|
||||
color.history.done=color0 on color6
|
||||
|
||||
# Report: summary
|
||||
color.summary.background=on color7
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -68,7 +68,13 @@ _task_offer_projects() {
|
||||
COMPREPLY=( $(compgen -W "$($taskcommand _projects)" -- ${cur/*:/}) )
|
||||
}
|
||||
|
||||
_task()
|
||||
_task_offer_contexts() {
|
||||
COMPREPLY=( $(compgen -W "$($taskcommand _context) define delete list none show" -- $cur) )
|
||||
}
|
||||
|
||||
_task_context_alias=$($taskcommand show | grep alias.*context | cut -d' ' -f1 | cut -d. -f2)
|
||||
|
||||
_task()
|
||||
{
|
||||
local cur prev opts base
|
||||
|
||||
@@ -91,6 +97,10 @@ _task()
|
||||
opts="$commands_aliases $($taskcommand _columns)"
|
||||
|
||||
case "${prev}" in
|
||||
$_task_context_alias|cont|conte|contex|context)
|
||||
_task_offer_contexts
|
||||
return 0
|
||||
;;
|
||||
:)
|
||||
case "${prev2}" in
|
||||
pri|prior|priori|priorit|priority)
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# The on-add event is triggered separately for each task added
|
||||
# The on-add event is triggered separately for each task added. This hook
|
||||
# script can accept/reject the addition. Processing will continue.
|
||||
|
||||
# Input:
|
||||
# - line of JSON for the task added
|
||||
|
||||
# Output:
|
||||
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
# zero, otherwise ignored.
|
||||
# - minimal new task: {"description":"Buy milk"}
|
||||
# - to modify a task include complete JSON
|
||||
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||
# code is zero, otherwise they are considered errors.
|
||||
|
||||
# - Line of JSON for proposed new task.
|
||||
read new_task
|
||||
|
||||
# Output:
|
||||
# - JSON, modified or unmodified.
|
||||
# - Optional feedback/error.
|
||||
echo $new_task
|
||||
echo 'on-add'
|
||||
|
||||
# Status:
|
||||
# - 0: JSON accepted, non-JSON is feedback.
|
||||
# - non-0: JSON ignored, non-JSON is error.
|
||||
exit 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
read new_task
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# The on-exit event is triggered once, after all processing is complete, i.e.
|
||||
# last
|
||||
# The on-exit event is triggered once, after all processing is complete.
|
||||
# This hooks script has no effect on processing.
|
||||
|
||||
# Input:
|
||||
# - read-only line of JSON for each task added/modified
|
||||
|
||||
# Output:
|
||||
# - any emitted JSON is ignored
|
||||
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||
# code is zero, otherwise they are considered errors.
|
||||
|
||||
while read -t 1 modified_task
|
||||
# - Read-only line of JSON for each task added/modified
|
||||
while read modified_task
|
||||
do
|
||||
# Scan task
|
||||
echo $modified_task
|
||||
done
|
||||
|
||||
# Output:
|
||||
# - Optional feedback/error.
|
||||
echo 'on-exit'
|
||||
|
||||
# Status:
|
||||
# - 0: JSON ignored, non-JSON is feedback.
|
||||
# - non-0: JSON ignored, non-JSON is error.
|
||||
exit 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This hook script replaces the shadow file feature, found in Taskwarrior
|
||||
# prior to version 2.4.0.
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# The on-launch event is triggered once, after initialization, before any
|
||||
# processing occurs, i.e first
|
||||
# processing occurs. This hooks script has no effect on processing.
|
||||
|
||||
# Input:
|
||||
# - none
|
||||
# - None
|
||||
|
||||
# Output:
|
||||
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
# zero, otherwise ignored.
|
||||
# - minimal new task: {"description":"Buy milk"}
|
||||
# - to modify a task include complete JSON
|
||||
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||
# code is zero, otherwise they are considered errors.
|
||||
|
||||
# - Optional feedback/error.
|
||||
echo 'on-launch'
|
||||
|
||||
# Status:
|
||||
# - 0: JSON ignored, non-JSON is feedback.
|
||||
# - non-0: JSON ignored, non-JSON is error.
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# The on-modify event is triggered separately for each task added or modified
|
||||
# The on-modify event is triggered separately for each task modified. This hook
|
||||
# script can accept/reject the modification. Processing will continue.
|
||||
|
||||
# Input:
|
||||
# - line of JSON for the original task
|
||||
# - line of JSON for the modified task, the diff being the modification
|
||||
|
||||
# Output:
|
||||
# - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
# zero, otherwise ignored.
|
||||
# - minimal new task: {"description":"Buy milk"}
|
||||
# - to modify a task include complete JSON
|
||||
# - all emitted non-JSON lines are considered feedback messages if the exit
|
||||
# code is zero, otherwise they are considered errors.
|
||||
|
||||
read original_task
|
||||
read modified_task
|
||||
|
||||
# Output:
|
||||
# - JSON, modified or unmodified.
|
||||
# - Optional feedback/error.
|
||||
echo $modified_task
|
||||
echo 'on-modify'
|
||||
|
||||
# Status:
|
||||
# - 0: JSON accepted, non-JSON is feedback.
|
||||
# - non-0: JSON ignored, non-JSON is error.
|
||||
exit 0
|
||||
|
||||
67
src/CLI.cpp
67
src/CLI.cpp
@@ -374,6 +374,64 @@ void CLI::add (const std::string& arg)
|
||||
analyze ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::addContextFilter ()
|
||||
{
|
||||
// Detect if any context is set, and bail out if not
|
||||
std::string contextName = context.config.get ("context");
|
||||
|
||||
if (contextName == "")
|
||||
{
|
||||
context.debug("No context applied.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect if UUID or ID is set, and bail out
|
||||
if (_args.size ())
|
||||
{
|
||||
std::vector <A>::const_iterator a;
|
||||
for (a = _args.begin (); a != _args.end (); ++a)
|
||||
{
|
||||
if (a->hasTag ("FILTER") &&
|
||||
a->hasTag ("ATTRIBUTE") &&
|
||||
! a->hasTag ("TERMINATED") &&
|
||||
! a->hasTag ("WORD") &&
|
||||
(a->attribute ("raw") == "id" || a->attribute ("raw") == "uuid"))
|
||||
{
|
||||
context.debug(format("UUID/ID lexeme found '{1}', not applying context.", a->attribute ("raw")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply context
|
||||
context.debug("Applying context: " + contextName);
|
||||
std::string contextFilter = context.config.get ("context." + contextName);
|
||||
|
||||
if (contextFilter == "")
|
||||
context.debug("Context '" + contextName + "' not defined!");
|
||||
else
|
||||
{
|
||||
addRawFilter("( " + contextFilter + " )");
|
||||
if (context.verbose ("context"))
|
||||
context.footnote (format("Context '{1}' set. Use 'task context none' to remove.", contextName));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Process raw string into parsed filter.
|
||||
//
|
||||
void CLI::addRawFilter (const std::string& arg)
|
||||
{
|
||||
std::string lexeme;
|
||||
Lexer::Type type;
|
||||
Lexer lex (arg);
|
||||
lex.ambiguity (false);
|
||||
|
||||
while (lex.token (lexeme, type))
|
||||
add (lexeme);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Intended to be called after ::initialize() and ::add(), to perform the final
|
||||
// analysis. Analysis is also performed directly after the above, because there
|
||||
@@ -474,8 +532,14 @@ void CLI::applyOverrides ()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Extract all the FILTER-tagged items.
|
||||
const std::string CLI::getFilter ()
|
||||
const std::string CLI::getFilter (bool applyContext /* = true */)
|
||||
{
|
||||
// Handle context setting
|
||||
// Commands that don't want to respect current context should leverage
|
||||
// the applyContext argument
|
||||
if (applyContext)
|
||||
addContextFilter ();
|
||||
|
||||
std::string filter = "";
|
||||
if (_args.size ())
|
||||
{
|
||||
@@ -500,6 +564,7 @@ const std::string CLI::getFilter ()
|
||||
filter = "( " + filter + " )";
|
||||
}
|
||||
|
||||
context.debug("Derived filter: '" + filter + "'");
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,11 @@ public:
|
||||
void entity (const std::string&, const std::string&);
|
||||
void initialize (int, const char**);
|
||||
void add (const std::string&);
|
||||
void addContextFilter ();
|
||||
void addRawFilter (const std::string& arg);
|
||||
void analyze (bool parse = true, bool strict = false);
|
||||
void applyOverrides ();
|
||||
const std::string getFilter ();
|
||||
const std::string getFilter (bool applyContext = true);
|
||||
const std::vector <std::string> getWords ();
|
||||
bool canonicalize (std::string&, const std::string&, const std::string&) const;
|
||||
std::string getBinary () const;
|
||||
|
||||
@@ -82,6 +82,7 @@ std::string Config::_defaults =
|
||||
"# # Comma-separated list. May contain any subset of:\n"
|
||||
"#verbose=blank,header,footnote,label,new-id,new-uuid,affected,edit,special,project,sync,filter\n"
|
||||
"confirmation=yes # Confirmation on delete, big changes\n"
|
||||
"recurrence=yes # Enable recurrence\n"
|
||||
"recurrence.confirmation=prompt # Confirmation for propagating changes among recurring tasks (yes/no/prompt)\n"
|
||||
"allow.empty.filter=yes # An empty filter gets a warning and requires confirmation\n"
|
||||
"indent.annotation=2 # Indent spaces for annotations\n"
|
||||
@@ -116,6 +117,7 @@ std::string Config::_defaults =
|
||||
"dateformat.info=Y-M-D H:N:S # Preferred display date format for information\n"
|
||||
"dateformat.report= # Preferred display date format for reports\n"
|
||||
"dateformat.annotation= # Preferred display date format for annotations\n"
|
||||
"date.iso=yes # Enable ISO date support\n"
|
||||
"weekstart="
|
||||
STRING_DATE_SUNDAY_LONG
|
||||
" # Sunday or Monday only\n"
|
||||
@@ -163,29 +165,29 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"# Color controls.\n"
|
||||
"color=on # Enable color\n"
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(DARWIN)
|
||||
"\n"
|
||||
"rule.precedence.color=deleted,completed,active,keyword.,tag.,uda.,project.,overdue,scheduled,due.today,due,blocked,blocking,recurring,tagged,pri.\n"
|
||||
"\n"
|
||||
"# General decoration\n"
|
||||
"color.label=\n"
|
||||
"color.label.sort=\n"
|
||||
"color.alternate=on gray1\n"
|
||||
"color.alternate=on gray2\n"
|
||||
"color.header=color3\n"
|
||||
"color.footnote=color3\n"
|
||||
"color.warning=bold red\n"
|
||||
"color.error=color3\n"
|
||||
"color.debug=color3\n"
|
||||
"color.error=white on red\n"
|
||||
"color.debug=color4\n"
|
||||
"\n"
|
||||
"# Task state\n"
|
||||
"color.completed=rgb010 on white\n"
|
||||
"color.deleted=rgb100 on white\n"
|
||||
"color.completed=\n"
|
||||
"color.deleted=\n"
|
||||
"color.active=rgb555 on rgb410\n"
|
||||
"color.recurring=rgb013\n"
|
||||
"color.scheduled=on rgb001\n"
|
||||
"color.until=\n"
|
||||
"color.blocked=white on color8\n"
|
||||
"color.blocking=white on color15\n"
|
||||
"color.blocking=black on color15\n"
|
||||
"\n"
|
||||
"# Project\n"
|
||||
"color.project.none=\n"
|
||||
@@ -249,15 +251,15 @@ std::string Config::_defaults =
|
||||
"color.header=yellow\n"
|
||||
"color.footnote=yellow\n"
|
||||
"color.warning=bold red\n"
|
||||
"color.error=yellow\n"
|
||||
"color.debug=yellow\n"
|
||||
"color.error=white on red\n"
|
||||
"color.debug=blue\n"
|
||||
"\n"
|
||||
"# Task state\n"
|
||||
"color.completed=green on white\n"
|
||||
"color.deleted=red on white\n"
|
||||
"color.completed=\n"
|
||||
"color.deleted=\n"
|
||||
"color.active=black on bright green\n"
|
||||
"color.recurring=magenta\n"
|
||||
"color.scheduled=on green\n"
|
||||
"color.scheduled=white on green\n"
|
||||
"color.until=\n"
|
||||
"color.blocked=black on white\n"
|
||||
"color.blocking=black on bright white\n"
|
||||
@@ -358,19 +360,19 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"report.long.description=All details of tasks\n"
|
||||
"report.long.labels=ID,A,Created,Mod,Deps,P,Project,Tags,Recur,Wait,Sched,Due,Until,Description\n"
|
||||
"report.long.columns=id,start.active,entry,modified.age,depends,priority,project,tags,recur,wait.age,scheduled,due,until,description\n"
|
||||
"report.long.columns=id,start.active,entry,modified.age,depends,priority,project,tags,recur,wait.remaining,scheduled,due,until,description\n"
|
||||
"report.long.filter=status:pending\n"
|
||||
"report.long.sort=modified-\n"
|
||||
"\n"
|
||||
"report.list.description=Most details of tasks\n"
|
||||
"report.list.labels=ID,Active,Age,D,P,Project,Tags,R,Sch,Due,Until,Description,Urg\n"
|
||||
"report.list.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due,until.age,description.count,urgency\n"
|
||||
"report.list.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due,until.remaining,description.count,urgency\n"
|
||||
"report.list.filter=status:pending\n"
|
||||
"report.list.sort=start-,due+,project+/,urgency-\n"
|
||||
"report.list.sort=start-,due+,project+,urgency-\n"
|
||||
"\n"
|
||||
"report.ls.description=Few details of tasks\n"
|
||||
"report.ls.labels=ID,A,D,Project,Tags,R,Wait,S,Due,Until,Description\n"
|
||||
"report.ls.columns=id,start.active,depends.indicator,project,tags,recur.indicator,wait.age,scheduled.countdown,due.countdown,until.countdown,description.count\n"
|
||||
"report.ls.columns=id,start.active,depends.indicator,project,tags,recur.indicator,wait.remaining,scheduled.countdown,due.countdown,until.countdown,description.count\n"
|
||||
"report.ls.filter=status:pending\n"
|
||||
"report.ls.sort=start-,description+\n"
|
||||
"\n"
|
||||
@@ -382,13 +384,13 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"report.newest.description=Newest tasks\n"
|
||||
"report.newest.labels=ID,Active,Created,Age,Mod,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description\n"
|
||||
"report.newest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.age,scheduled.countdown,due,until.age,description\n"
|
||||
"report.newest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.remaining,scheduled.countdown,due,until.age,description\n"
|
||||
"report.newest.filter=(status:pending or status:waiting) and recur.none:\n"
|
||||
"report.newest.sort=entry-\n"
|
||||
"\n"
|
||||
"report.oldest.description=Oldest tasks\n"
|
||||
"report.oldest.labels=ID,Active,Created,Age,Mod,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description\n"
|
||||
"report.oldest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.age,scheduled.countdown,due,until.age,description\n"
|
||||
"report.oldest.columns=id,start.age,entry,entry.age,modified.age,depends.indicator,priority,project,tags,recur.indicator,wait.remaining,scheduled.countdown,due,until.age,description\n"
|
||||
"report.oldest.filter=(status:pending or status:waiting)\n"
|
||||
"report.oldest.sort=entry+\n"
|
||||
"\n"
|
||||
@@ -400,7 +402,7 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"report.active.description=Active tasks\n"
|
||||
"report.active.labels=ID,Started,Active,Age,D,P,Project,Tags,Recur,W,Sch,Due,Until,Description\n"
|
||||
"report.active.columns=id,start,start.age,entry.age,depends.indicator,priority,project,tags,recur,wait.indicator,scheduled.age,due,until,description\n"
|
||||
"report.active.columns=id,start,start.age,entry.age,depends.indicator,priority,project,tags,recur,wait.indicator,scheduled.remaining,due,until,description\n"
|
||||
"report.active.filter=status:pending and +ACTIVE\n"
|
||||
"report.active.sort=project+,start+\n"
|
||||
"\n"
|
||||
@@ -412,30 +414,30 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"report.recurring.description=Recurring Tasks\n"
|
||||
"report.recurring.labels=ID,Active,Age,D,P,Project,Tags,Recur,Sch,Due,Until,Description,Urg\n"
|
||||
"report.recurring.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur,scheduled.countdown,due,until.age,description,urgency\n"
|
||||
"report.recurring.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur,scheduled.countdown,due,until.remaining,description,urgency\n"
|
||||
"report.recurring.filter=(status:pending or status:waiting) and (+PARENT or +CHILD)\n"
|
||||
"report.recurring.sort=due+,urgency-,entry+\n"
|
||||
"\n"
|
||||
"report.waiting.description=Waiting (hidden) tasks\n"
|
||||
"report.waiting.labels=ID,A,Age,D,P,Project,Tags,R,Wait,for,Sched,Due,Until,Description\n"
|
||||
"report.waiting.columns=id,start.active,entry.age,depends.indicator,priority,project,tags,recur.indicator,wait,wait.age,scheduled,due,until,description\n"
|
||||
"report.waiting.columns=id,start.active,entry.age,depends.indicator,priority,project,tags,recur.indicator,wait,wait.remaining,scheduled,due,until,description\n"
|
||||
"report.waiting.filter=+WAITING\n"
|
||||
"report.waiting.sort=due+,wait+,entry+\n"
|
||||
"\n"
|
||||
"report.all.description=All tasks\n"
|
||||
"report.all.labels=ID,St,UUID,A,Age,Done,D,P,Project,Tags,R,Wait,Sch,Due,Until,Description\n"
|
||||
"report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.age,scheduled.age,due,until.age,description\n"
|
||||
"report.all.columns=id,status.short,uuid.short,start.active,entry.age,end.age,depends.indicator,priority,project.parent,tags.count,recur.indicator,wait.remaining,scheduled.remaining,due,until.remaining,description\n"
|
||||
"report.all.sort=entry-\n"
|
||||
"\n"
|
||||
"report.next.description=Most urgent tasks\n"
|
||||
"report.next.labels=ID,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg\n"
|
||||
"report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.age,until.age,description,urgency\n"
|
||||
"report.next.columns=id,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.remaining,until.remaining,description,urgency\n"
|
||||
"report.next.filter=status:pending limit:page\n"
|
||||
"report.next.sort=start-,urgency-\n"
|
||||
"report.next.sort=urgency-\n"
|
||||
"\n"
|
||||
"report.ready.description=Most urgent actionable tasks\n"
|
||||
"report.ready.labels=ID,Active,Age,D,P,Project,Tags,R,S,Due,Until,Description,Urg\n"
|
||||
"report.ready.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due.countdown,until.age,description,urgency\n"
|
||||
"report.ready.columns=id,start.age,entry.age,depends.indicator,priority,project,tags,recur.indicator,scheduled.countdown,due.countdown,until.remaining,description,urgency\n"
|
||||
"report.ready.filter=+READY\n"
|
||||
"report.ready.sort=start-,urgency-\n"
|
||||
"\n"
|
||||
@@ -453,7 +455,7 @@ std::string Config::_defaults =
|
||||
"\n"
|
||||
"report.blocking.description=Blocking tasks\n"
|
||||
"report.blocking.labels=ID,UUID,A,Deps,Project,Tags,R,W,Sch,Due,Until,Description,Urg\n"
|
||||
"report.blocking.columns=id,uuid.short,start.active,depends,project,tags,recur,wait.indicator,scheduled.age,due.age,until.age,description.count,urgency\n"
|
||||
"report.blocking.columns=id,uuid.short,start.active,depends,project,tags,recur,wait.indicator,scheduled.remaining,due.remaining,until.remaining,description.count,urgency\n"
|
||||
"report.blocking.sort=urgency-,due+,entry+\n"
|
||||
"report.blocking.filter= status:pending +BLOCKING\n"
|
||||
"\n";
|
||||
|
||||
@@ -275,7 +275,7 @@ int Context::initialize (int argc, const char** argv)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// [8] Run on.launch hooks.
|
||||
// [8] Initialize hooks.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -504,7 +504,7 @@ bool Context::color ()
|
||||
use_color = config.getBoolean ("color");
|
||||
|
||||
// Only tty's support color.
|
||||
if (! isatty (fileno (stdout)))
|
||||
if (! isatty (STDOUT_FILENO))
|
||||
{
|
||||
// No ioctl.
|
||||
config.set ("detection", "off");
|
||||
@@ -658,6 +658,7 @@ void Context::staticInitialization ()
|
||||
Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive");
|
||||
Task::regex = Variant::searchUsingRegex = config.getBoolean ("regex");
|
||||
Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat");
|
||||
Lexer::isoEnabled = Variant::isoEnabled = config.getBoolean ("date.iso");
|
||||
|
||||
std::map <std::string, Column*>::iterator i;
|
||||
for (i = columns.begin (); i != columns.end (); ++i)
|
||||
@@ -770,7 +771,7 @@ void Context::clear ()
|
||||
// this output?'.
|
||||
void Context::updateXtermTitle ()
|
||||
{
|
||||
if (config.getBoolean ("xterm.title") && isatty (fileno (stdout)))
|
||||
if (config.getBoolean ("xterm.title") && isatty (STDOUT_FILENO))
|
||||
{
|
||||
std::string command = cli.getCommand ();
|
||||
std::string title;
|
||||
|
||||
12
src/DOM.cpp
12
src/DOM.cpp
@@ -240,6 +240,12 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
||||
Column* column = context.columns[canonical];
|
||||
if (column)
|
||||
{
|
||||
if (column->is_uda () && ! task.has (canonical))
|
||||
{
|
||||
value = Variant ("''");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (column->type () == "date")
|
||||
value = Variant (task.get_date (canonical), Variant::type_date);
|
||||
else if (column->type () == "duration" || canonical == "recur")
|
||||
@@ -307,6 +313,12 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value)
|
||||
Column* column = context.columns[canonical];
|
||||
if (column)
|
||||
{
|
||||
if (column->is_uda () && ! ref.has (canonical))
|
||||
{
|
||||
value = Variant ("''");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (column->type () == "date")
|
||||
value = Variant (ref.get_date (canonical), Variant::type_date);
|
||||
else if (column->type () == "duration")
|
||||
|
||||
@@ -61,31 +61,48 @@ static struct
|
||||
{"fortnight", 14 * DAY, true},
|
||||
{"hours", 1 * HOUR, false},
|
||||
{"hour", 1 * HOUR, true},
|
||||
{"hrs", 1 * HOUR, true},
|
||||
{"hr", 1 * HOUR, true},
|
||||
{"h", 1 * HOUR, false},
|
||||
{"minutes", 1 * MINUTE, false},
|
||||
{"minute", 1 * MINUTE, false},
|
||||
{"mins", 1 * MINUTE, false},
|
||||
{"min", 1 * MINUTE, false},
|
||||
{"monthly", 30 * DAY, true},
|
||||
{"months", 30 * DAY, false},
|
||||
{"month", 30 * DAY, true},
|
||||
{"mnths", 30 * DAY, false},
|
||||
{"mths", 30 * DAY, false},
|
||||
{"mth", 30 * DAY, false},
|
||||
{"mos", 30 * DAY, false},
|
||||
{"mo", 30 * DAY, false},
|
||||
{"m", 30 * DAY, false},
|
||||
{"quarterly", 91 * DAY, true},
|
||||
{"quarters", 91 * DAY, false},
|
||||
{"quarter", 91 * DAY, true},
|
||||
{"qrtrs", 91 * DAY, false},
|
||||
{"qtrs", 91 * DAY, false},
|
||||
{"qtr", 91 * DAY, false},
|
||||
{"q", 91 * DAY, false},
|
||||
{"semiannual", 183 * DAY, true},
|
||||
{"sennight", 14 * DAY, false},
|
||||
{"seconds", 1 * SECOND, false},
|
||||
{"second", 1 * SECOND, true},
|
||||
{"secs", 1 * SECOND, true},
|
||||
{"sec", 1 * SECOND, true},
|
||||
{"s", 1 * SECOND, false},
|
||||
{"weekdays", 1 * DAY, true},
|
||||
{"weekly", 7 * DAY, true},
|
||||
{"weeks", 7 * DAY, false},
|
||||
{"week", 7 * DAY, true},
|
||||
{"wks", 7 * DAY, true},
|
||||
{"wk", 7 * DAY, true},
|
||||
{"w", 7 * DAY, false},
|
||||
{"yearly", 365 * DAY, true},
|
||||
{"years", 365 * DAY, false},
|
||||
{"year", 365 * DAY, true},
|
||||
{"yrs", 365 * DAY, true},
|
||||
{"yr", 365 * DAY, true},
|
||||
{"y", 365 * DAY, false},
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ Filter::~Filter ()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Take an input set of tasks and filter into a subset.
|
||||
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output)
|
||||
void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output, bool applyContext /* = true */)
|
||||
{
|
||||
context.timer_filter.start ();
|
||||
_startCount = (int) input.size ();
|
||||
@@ -75,7 +75,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
||||
if (context.config.getInteger ("debug.parser") >= 1)
|
||||
context.debug (context.cli.dump ("Filter::subset"));
|
||||
|
||||
std::string filterExpr = context.cli.getFilter ();
|
||||
std::string filterExpr = context.cli.getFilter (applyContext);
|
||||
if (filterExpr.length ())
|
||||
{
|
||||
Eval eval;
|
||||
@@ -111,7 +111,7 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Take the set of all tasks and filter into a subset.
|
||||
void Filter::subset (std::vector <Task>& output)
|
||||
void Filter::subset (std::vector <Task>& output, bool applyContext /* = true */)
|
||||
{
|
||||
context.timer_filter.start ();
|
||||
|
||||
@@ -119,7 +119,7 @@ void Filter::subset (std::vector <Task>& output)
|
||||
context.debug (context.cli.dump ("Filter::subset"));
|
||||
|
||||
bool shortcut = false;
|
||||
std::string filterExpr = context.cli.getFilter ();
|
||||
std::string filterExpr = context.cli.getFilter (applyContext);
|
||||
if (filterExpr.length ())
|
||||
{
|
||||
context.timer_filter.stop ();
|
||||
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
Filter ();
|
||||
~Filter ();
|
||||
|
||||
void subset (const std::vector <Task>&, std::vector <Task>&);
|
||||
void subset (std::vector <Task>&);
|
||||
void subset (const std::vector <Task>&, std::vector <Task>&, bool applyContext = true);
|
||||
void subset (std::vector <Task>&, bool applyContext = true);
|
||||
bool pendingOnly ();
|
||||
void safety ();
|
||||
|
||||
|
||||
400
src/Hooks.cpp
400
src/Hooks.cpp
@@ -38,8 +38,10 @@
|
||||
#include <Context.h>
|
||||
#include <JSON.h>
|
||||
#include <Hooks.h>
|
||||
#include <Timer.h>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <i18n.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
@@ -73,7 +75,17 @@ void Hooks::initialize ()
|
||||
{
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = _scripts.begin (); i != _scripts.end (); ++i)
|
||||
context.debug ("Found hook script " + *i);
|
||||
{
|
||||
Path p (*i);
|
||||
std::string name = p.name ();
|
||||
if (name.substr (0, 6) == "on-add" ||
|
||||
name.substr (0, 9) == "on-modify" ||
|
||||
name.substr (0, 9) == "on-launch" ||
|
||||
name.substr (0, 7) == "on-exit")
|
||||
context.debug ("Found hook script " + *i);
|
||||
else
|
||||
context.debug ("Found misnamed hook script " + *i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_debug >= 1)
|
||||
@@ -98,8 +110,7 @@ bool Hooks::enable (bool value)
|
||||
// - none
|
||||
//
|
||||
// Output:
|
||||
// - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
// zero, otherwise ignored.
|
||||
// - JSON not allowed.
|
||||
// - all emitted non-JSON lines are considered feedback or error messages
|
||||
// depending on the status code.
|
||||
//
|
||||
@@ -120,29 +131,28 @@ void Hooks::onLaunch ()
|
||||
std::vector <std::string> output;
|
||||
int status = callHookScript (*script, input, output);
|
||||
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = output.begin (); line != output.end (); ++line)
|
||||
{
|
||||
if (isJSON (*line))
|
||||
{
|
||||
if (status == 0)
|
||||
{
|
||||
// Only 'add' is possible.
|
||||
Task newTask (*line);
|
||||
context.tdb2.add (newTask);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == 0)
|
||||
context.header (*line);
|
||||
else
|
||||
context.error (*line);
|
||||
}
|
||||
}
|
||||
std::vector <std::string> outputJSON;
|
||||
std::vector <std::string> outputFeedback;
|
||||
separateOutput (output, outputJSON, outputFeedback);
|
||||
|
||||
assertNTasks (outputJSON, 0);
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.footnote (*message);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
|
||||
if (status)
|
||||
throw 0; // This is how hooks silently terminate processing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +167,7 @@ void Hooks::onLaunch ()
|
||||
// - read-only line of JSON for each task added/modified
|
||||
//
|
||||
// Output:
|
||||
// - any emitted JSON is ignored
|
||||
// - all emitted JSON is ignored
|
||||
// - all emitted non-JSON lines are considered feedback or error messages
|
||||
// depending on the status code.
|
||||
//
|
||||
@@ -188,24 +198,28 @@ void Hooks::onExit ()
|
||||
std::vector <std::string> output;
|
||||
int status = callHookScript (*script, input, output);
|
||||
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = output.begin (); line != output.end (); ++line)
|
||||
{
|
||||
if (isJSON (*line))
|
||||
{
|
||||
context.error ("JSON output ignored: {1}");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == 0)
|
||||
context.footnote (*line);
|
||||
else
|
||||
context.error (*line);
|
||||
}
|
||||
}
|
||||
std::vector <std::string> outputJSON;
|
||||
std::vector <std::string> outputFeedback;
|
||||
separateOutput (output, outputJSON, outputFeedback);
|
||||
|
||||
assertNTasks (outputJSON, 0);
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.footnote (*message);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
|
||||
if (status)
|
||||
throw 0; // This is how hooks silently terminate processing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,14 +233,14 @@ void Hooks::onExit ()
|
||||
// - line of JSON for the task added
|
||||
//
|
||||
// Output:
|
||||
// - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
// zero, otherwise ignored.
|
||||
// - emitted JSON for the input task is added, if the exit code is zero,
|
||||
// otherwise ignored.
|
||||
// - all emitted non-JSON lines are considered feedback or error messages
|
||||
// depending on the status code.
|
||||
//
|
||||
void Hooks::onAdd (std::vector <Task>& tasks)
|
||||
void Hooks::onAdd (Task& task)
|
||||
{
|
||||
if (! _enabled || tasks.size () < 1)
|
||||
if (! _enabled)
|
||||
return;
|
||||
|
||||
context.timer_hooks.start ();
|
||||
@@ -234,9 +248,9 @@ void Hooks::onAdd (std::vector <Task>& tasks)
|
||||
std::vector <std::string> matchingScripts = scripts ("on-add");
|
||||
if (matchingScripts.size ())
|
||||
{
|
||||
// Convert vector of tasks to a vector of strings.
|
||||
// Convert task to a vector of strings.
|
||||
std::vector <std::string> input;
|
||||
input.push_back (tasks[0].composeJSON ());
|
||||
input.push_back (task.composeJSON ());
|
||||
|
||||
// Call the hook scripts.
|
||||
std::vector <std::string>::iterator script;
|
||||
@@ -245,33 +259,37 @@ void Hooks::onAdd (std::vector <Task>& tasks)
|
||||
std::vector <std::string> output;
|
||||
int status = callHookScript (*script, input, output);
|
||||
|
||||
input.clear ();
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = output.begin (); line != output.end (); ++line)
|
||||
{
|
||||
if (isJSON (*line))
|
||||
{
|
||||
if (status == 0)
|
||||
input.push_back (*line);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == 0)
|
||||
context.footnote (*line);
|
||||
else
|
||||
context.error (*line);
|
||||
}
|
||||
}
|
||||
std::vector <std::string> outputJSON;
|
||||
std::vector <std::string> outputFeedback;
|
||||
separateOutput (output, outputJSON, outputFeedback);
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
assertNTasks (outputJSON, 1);
|
||||
assertValidJSON (outputJSON);
|
||||
assertSameTask (outputJSON, task);
|
||||
|
||||
// Propagate forward to the next script.
|
||||
input[0] = outputJSON[0];
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.footnote (*message);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
|
||||
if (status)
|
||||
throw 0; // This is how hooks silently terminate processing.
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer the modified task lines back to the original task list.
|
||||
tasks.clear ();
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = input.begin (); i != input.end (); ++i)
|
||||
tasks.push_back (Task (*i));
|
||||
// Transfer the modified task back to the original task.
|
||||
task = Task (input[0]);
|
||||
}
|
||||
|
||||
context.timer_hooks.stop ();
|
||||
@@ -285,14 +303,14 @@ void Hooks::onAdd (std::vector <Task>& tasks)
|
||||
// - line of JSON for the modified task, the diff being the modification
|
||||
//
|
||||
// Output:
|
||||
// - all emitted JSON lines are added/modified as tasks, if the exit code is
|
||||
// zero, otherwise ignored.
|
||||
// - emitted JSON for the input task is saved, if the exit code is zero,
|
||||
// otherwise ignored.
|
||||
// - all emitted non-JSON lines are considered feedback or error messages
|
||||
// depending on the status code.
|
||||
//
|
||||
void Hooks::onModify (const Task& before, std::vector <Task>& tasks)
|
||||
void Hooks::onModify (const Task& before, Task& after)
|
||||
{
|
||||
if (! _enabled || tasks.size () < 1)
|
||||
if (! _enabled)
|
||||
return;
|
||||
|
||||
context.timer_hooks.start ();
|
||||
@@ -300,61 +318,48 @@ void Hooks::onModify (const Task& before, std::vector <Task>& tasks)
|
||||
std::vector <std::string> matchingScripts = scripts ("on-modify");
|
||||
if (matchingScripts.size ())
|
||||
{
|
||||
// Prepare invariants.
|
||||
std::string beforeJSON = before.composeJSON ();
|
||||
std::string uuidPattern = "\"uuid\":\"" + before.get ("uuid") + "\"";
|
||||
|
||||
// Convert vector of tasks to a vector of strings.
|
||||
std::vector <std::string> input;
|
||||
input.push_back (beforeJSON); // [0] original, never changes
|
||||
input.push_back (tasks[0].composeJSON ()); // [1] original'
|
||||
input.push_back (before.composeJSON ()); // [line 0] original, never changes
|
||||
input.push_back (after.composeJSON ()); // [line 1] modified
|
||||
|
||||
// Call the hook scripts.
|
||||
std::vector <std::string>::iterator script;
|
||||
for (script = matchingScripts.begin (); script != matchingScripts.end (); ++script)
|
||||
{
|
||||
std::vector <std::string> firstTwoOnly;
|
||||
firstTwoOnly.push_back (input[0]);
|
||||
firstTwoOnly.push_back (input[1]);
|
||||
|
||||
std::vector <std::string> output;
|
||||
int status = callHookScript (*script, firstTwoOnly, output);
|
||||
int status = callHookScript (*script, input, output);
|
||||
|
||||
// Start from scratch.
|
||||
input[1] = ""; // [1] placeholder for original'
|
||||
std::vector <std::string> outputJSON;
|
||||
std::vector <std::string> outputFeedback;
|
||||
separateOutput (output, outputJSON, outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = output.begin (); line != output.end (); ++line)
|
||||
if (status == 0)
|
||||
{
|
||||
if (isJSON (*line))
|
||||
{
|
||||
if (status == 0)
|
||||
{
|
||||
if (line->find (uuidPattern) != std::string::npos)
|
||||
input[1] = *line; // [1] original'
|
||||
else
|
||||
input.push_back (*line); // [n > 1] extras
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (status == 0)
|
||||
context.footnote (*line);
|
||||
else
|
||||
context.error (*line);
|
||||
}
|
||||
}
|
||||
assertNTasks (outputJSON, 1);
|
||||
assertValidJSON (outputJSON);
|
||||
assertSameTask (outputJSON, before);
|
||||
|
||||
// Propagate accepted changes forward to the next script.
|
||||
input[1] = outputJSON[0];
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.footnote (*message);
|
||||
}
|
||||
else
|
||||
{
|
||||
assertFeedback (outputFeedback);
|
||||
|
||||
std::vector <std::string>::iterator message;
|
||||
for (message = outputFeedback.begin (); message != outputFeedback.end (); ++message)
|
||||
context.error (*message);
|
||||
|
||||
if (status)
|
||||
throw 0; // This is how hooks silently terminate processing.
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer the modified task lines back to the original task list.
|
||||
tasks.clear ();
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = input.begin (); i != input.end (); ++i)
|
||||
if (i != input.begin ())
|
||||
tasks.push_back (Task (*i));
|
||||
after = Task (input[1]);
|
||||
}
|
||||
|
||||
context.timer_hooks.stop ();
|
||||
@@ -384,65 +389,135 @@ std::vector <std::string> Hooks::scripts (const std::string& event)
|
||||
return matching;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::separateOutput (
|
||||
const std::vector <std::string>& output,
|
||||
std::vector <std::string>& json,
|
||||
std::vector <std::string>& feedback) const
|
||||
{
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = output.begin (); i != output.end (); ++i)
|
||||
{
|
||||
if (isJSON (*i))
|
||||
json.push_back (*i);
|
||||
else
|
||||
feedback.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Hooks::isJSON (const std::string& input) const
|
||||
{
|
||||
// Does it even look like JSON? {...}
|
||||
if (input.length () > 2 &&
|
||||
input[0] == '{' &&
|
||||
input[input.length () - 1] == '}')
|
||||
return input.length () > 2 &&
|
||||
input[0] == '{' &&
|
||||
input[input.length () - 1] == '}';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertValidJSON (const std::vector <std::string>& input) const
|
||||
{
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = input.begin (); i != input.end (); i++)
|
||||
{
|
||||
if (i->length () < 3 ||
|
||||
(*i)[0] != '{' ||
|
||||
(*i)[i->length () - 1] != '}')
|
||||
{
|
||||
context.error (STRING_HOOK_ERROR_OBJECT);
|
||||
throw 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// The absolute minimum a task needs is:
|
||||
bool foundDescription = false;
|
||||
|
||||
// Parse the whole thing.
|
||||
json::value* root = json::parse (input);
|
||||
if (root->type () == json::j_object)
|
||||
json::value* root = json::parse (*i);
|
||||
if (root->type () != json::j_object)
|
||||
{
|
||||
json::object* root_obj = (json::object*)root;
|
||||
|
||||
// For each object element...
|
||||
json_object_iter i;
|
||||
for (i = root_obj->_data.begin ();
|
||||
i != root_obj->_data.end ();
|
||||
++i)
|
||||
{
|
||||
// If the attribute is a recognized column.
|
||||
std::string type = Task::attributes[i->first];
|
||||
if (type == "string" && i->first == "description")
|
||||
foundDescription = true;
|
||||
}
|
||||
context.error (STRING_HOOK_ERROR_OBJECT);
|
||||
throw 0;
|
||||
}
|
||||
else
|
||||
throw std::string ("Object expected.");
|
||||
|
||||
// It's JSON, but is it a task?
|
||||
if (! foundDescription)
|
||||
throw std::string ("Missing 'description' attribute, of type 'string'.");
|
||||
if (((json::object*)root)->_data.find ("description") == ((json::object*)root)->_data.end ())
|
||||
{
|
||||
context.error (STRING_HOOK_ERROR_NODESC);
|
||||
throw 0;
|
||||
}
|
||||
|
||||
// Yep, looks like a JSON task.
|
||||
return true;
|
||||
if (((json::object*)root)->_data.find ("uuid") == ((json::object*)root)->_data.end ())
|
||||
{
|
||||
context.error (STRING_HOOK_ERROR_NOUUID);
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
||||
catch (const std::string& e)
|
||||
{
|
||||
if (_debug >= 1)
|
||||
context.error ("Hook output looks like JSON, but is not a valid task.");
|
||||
|
||||
if (_debug >= 2)
|
||||
context.error ("JSON " + e);
|
||||
context.error (format (STRING_HOOK_ERROR_SYNTAX, *i));
|
||||
if (_debug)
|
||||
context.error (STRING_HOOK_ERROR_JSON + e);
|
||||
throw 0;
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
if (_debug >= 1)
|
||||
context.error ("Hook output looks like JSON, but fails to parse.");
|
||||
context.error (STRING_HOOK_ERROR_NOPARSE + *i);
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertNTasks (const std::vector <std::string>& input, int n) const
|
||||
{
|
||||
if (input.size () != n)
|
||||
{
|
||||
context.error (format (STRING_HOOK_ERROR_BAD_NUM, n, (int) input.size ()));
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertSameTask (const std::vector <std::string>& input, const Task& task) const
|
||||
{
|
||||
std::string uuid = task.get ("uuid");
|
||||
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = input.begin (); i != input.end (); i++)
|
||||
{
|
||||
json::object* root_obj = (json::object*)json::parse (*i);
|
||||
|
||||
// If there is no UUID at all.
|
||||
json_object_iter u = root_obj->_data.find ("uuid");
|
||||
if (u == root_obj->_data.end () ||
|
||||
u->second->type () != json::j_string)
|
||||
{
|
||||
context.error (format (STRING_HOOK_ERROR_SAME1, uuid));
|
||||
throw 0;
|
||||
}
|
||||
|
||||
json::string* up = (json::string*) u->second;
|
||||
std::string json_uuid = json::decode (unquoteText (up->dump ()));
|
||||
if (json_uuid != uuid)
|
||||
{
|
||||
context.error (format (STRING_HOOK_ERROR_SAME2, uuid, json_uuid));
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertFeedback (const std::vector <std::string>& input) const
|
||||
{
|
||||
bool foundSomething = false;
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = input.begin (); i != input.end (); ++i)
|
||||
if (nontrivial (*i))
|
||||
foundSomething = true;
|
||||
|
||||
if (! foundSomething)
|
||||
{
|
||||
context.error (STRING_HOOK_ERROR_NOFEEDBACK);
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -452,11 +527,11 @@ int Hooks::callHookScript (
|
||||
std::vector <std::string>& output)
|
||||
{
|
||||
if (_debug >= 1)
|
||||
context.debug ("Hooks: Calling " + script);
|
||||
context.debug ("Hook: Calling " + script);
|
||||
|
||||
if (_debug >= 2)
|
||||
{
|
||||
context.debug ("Hooks: input");
|
||||
context.debug ("Hook: input");
|
||||
std::vector <std::string>::const_iterator i;
|
||||
for (i = input.begin (); i != input.end (); ++i)
|
||||
context.debug (" " + *i);
|
||||
@@ -469,19 +544,30 @@ int Hooks::callHookScript (
|
||||
|
||||
std::string outputStr;
|
||||
std::vector <std::string> args;
|
||||
int status = execute (script, args, inputStr, outputStr);
|
||||
int status;
|
||||
|
||||
// Measure time for each hook if running in debug
|
||||
if (_debug >= 2)
|
||||
{
|
||||
Timer timer_per_hook("Hooks::execute (" + script + ")");
|
||||
timer_per_hook.start();
|
||||
|
||||
status = execute (script, args, inputStr, outputStr);
|
||||
}
|
||||
else
|
||||
status = execute (script, args, inputStr, outputStr);
|
||||
|
||||
split (output, outputStr, '\n');
|
||||
|
||||
if (_debug >= 2)
|
||||
{
|
||||
context.debug ("Hooks: output");
|
||||
context.debug ("Hook: output");
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = output.begin (); i != output.end (); ++i)
|
||||
if (*i != "")
|
||||
context.debug (" " + *i);
|
||||
|
||||
context.debug (format ("Hooks: Completed with status {1}", status));
|
||||
context.debug (format ("Hook: Completed with status {1}", status));
|
||||
context.debug (" "); // Blank line
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,19 @@ public:
|
||||
|
||||
void onLaunch ();
|
||||
void onExit ();
|
||||
void onAdd (std::vector <Task>&);
|
||||
void onModify (const Task&, std::vector <Task>&);
|
||||
void onAdd (Task&);
|
||||
void onModify (const Task&, Task&);
|
||||
|
||||
std::vector <std::string> list ();
|
||||
|
||||
private:
|
||||
std::vector <std::string> scripts (const std::string&);
|
||||
void separateOutput (const std::vector <std::string>&, std::vector <std::string>&, std::vector <std::string>&) const;
|
||||
bool isJSON (const std::string&) const;
|
||||
void assertValidJSON (const std::vector <std::string>&) const;
|
||||
void assertNTasks (const std::vector <std::string>&, int) const;
|
||||
void assertSameTask (const std::vector <std::string>&, const Task&) const;
|
||||
void assertFeedback (const std::vector <std::string>&) const;
|
||||
int callHookScript (const std::string&, const std::vector <std::string>&, std::vector <std::string>&);
|
||||
|
||||
private:
|
||||
|
||||
@@ -702,7 +702,7 @@ void ISO8601d::resolve ()
|
||||
t.tm_min = (seconds % 3600) / 60;
|
||||
t.tm_sec = seconds % 60;
|
||||
|
||||
_value = utc ? timegm (&t) : timelocal (&t);
|
||||
_value = utc ? timegm (&t) : mktime (&t);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <i18n.h>
|
||||
|
||||
std::string Lexer::dateFormat = "";
|
||||
bool Lexer::isoEnabled = true;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Lexer::Lexer (const std::string& input)
|
||||
@@ -386,6 +387,12 @@ bool Lexer::token (std::string& result, Type& type)
|
||||
result += utf8_character (_n0);
|
||||
shift ();
|
||||
}
|
||||
else
|
||||
{
|
||||
result += utf8_character (hex_to_int (_n0, _n1, _n2, _n3));
|
||||
shift ();
|
||||
type = quote ? typeString : typeIdentifier;
|
||||
}
|
||||
break;
|
||||
|
||||
case typeExponent:
|
||||
@@ -732,15 +739,18 @@ void Lexer::dequote (std::string& input)
|
||||
bool Lexer::is_date (std::string& result)
|
||||
{
|
||||
// Try an ISO date parse.
|
||||
std::string::size_type iso_i = 0;
|
||||
std::string iso_result;
|
||||
ISO8601d iso;
|
||||
iso.ambiguity (_ambiguity);
|
||||
if (iso.parse (_input.substr (_shift_counter), iso_i))
|
||||
if (isoEnabled)
|
||||
{
|
||||
result = _input.substr (_shift_counter, iso_i);
|
||||
while (iso_i--) shift ();
|
||||
return true;
|
||||
std::string::size_type iso_i = 0;
|
||||
std::string iso_result;
|
||||
ISO8601d iso;
|
||||
iso.ambiguity (_ambiguity);
|
||||
if (iso.parse (_input.substr (_shift_counter), iso_i))
|
||||
{
|
||||
result = _input.substr (_shift_counter, iso_i);
|
||||
while (iso_i--) shift ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Try a legacy rc.dateformat parse here.
|
||||
|
||||
@@ -34,6 +34,7 @@ class Lexer
|
||||
{
|
||||
public:
|
||||
static std::string dateFormat;
|
||||
static bool isoEnabled;
|
||||
|
||||
enum Type
|
||||
{
|
||||
|
||||
@@ -403,33 +403,6 @@ bool Nibbler::getInt (int& result)
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getHex (int& result)
|
||||
{
|
||||
std::string::size_type i = _cursor;
|
||||
|
||||
if (i < _length)
|
||||
{
|
||||
if (_input[i] == '-')
|
||||
++i;
|
||||
else if (_input[i] == '+')
|
||||
++i;
|
||||
}
|
||||
|
||||
// TODO Potential for use of find_first_not_of
|
||||
while (i < _length && isxdigit (_input[i]))
|
||||
++i;
|
||||
|
||||
if (i > _cursor)
|
||||
{
|
||||
result = strtoimax (_input.substr (_cursor, i - _cursor).c_str (), NULL, 16);
|
||||
_cursor = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::getUnsignedInt (int& result)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,6 @@ public:
|
||||
bool getDigit3 (int&);
|
||||
bool getDigit2 (int&);
|
||||
bool getInt (int&);
|
||||
bool getHex (int&);
|
||||
bool getUnsignedInt (int&);
|
||||
bool getNumber (std::string&);
|
||||
bool getNumber (double&);
|
||||
|
||||
134
src/TDB2.cpp
134
src/TDB2.cpp
@@ -567,12 +567,12 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */)
|
||||
if (!verifyUniqueUUID (uuid))
|
||||
throw format (STRING_TDB2_UUID_NOT_UNIQUE, uuid);
|
||||
|
||||
// Create a vector tasks, as hooks can cause them to multiply.
|
||||
std::vector <Task> changes;
|
||||
changes.push_back (task);
|
||||
context.hooks.onAdd (changes);
|
||||
// Only locally-added tasks trigger hooks. This means that tasks introduced
|
||||
// via 'sync' do not trigger hooks.
|
||||
if (add_to_backlog)
|
||||
context.hooks.onAdd (task);
|
||||
|
||||
update (uuid, task, add_to_backlog, changes);
|
||||
update (uuid, task, add_to_backlog, true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -580,19 +580,17 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
|
||||
{
|
||||
// Ensure the task is consistent, and provide defaults if necessary.
|
||||
task.validate (false);
|
||||
task.upgradeLegacyValues ();
|
||||
std::string uuid = task.get ("uuid");
|
||||
|
||||
// Get the unmodified task as reference, so the hook can compare.
|
||||
Task original;
|
||||
get (uuid, original);
|
||||
if (add_to_backlog)
|
||||
{
|
||||
Task original;
|
||||
get (uuid, original);
|
||||
context.hooks.onModify (original, task);
|
||||
}
|
||||
|
||||
// Create a vector tasks, as hooks can cause them to multiply.
|
||||
std::vector <Task> changes;
|
||||
changes.push_back (task);
|
||||
context.hooks.onModify (original, changes);
|
||||
|
||||
update (uuid, task, add_to_backlog, changes);
|
||||
update (uuid, task, add_to_backlog);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -600,61 +598,50 @@ void TDB2::update (
|
||||
const std::string& uuid,
|
||||
Task& task,
|
||||
const bool add_to_backlog,
|
||||
std::vector <Task>& changes)
|
||||
const bool addition)
|
||||
{
|
||||
std::vector <Task>::iterator i;
|
||||
for (i = changes.begin (); i != changes.end (); ++i)
|
||||
// Validate to add metadata.
|
||||
task.validate (false);
|
||||
|
||||
// If the task already exists, it is a modification, else addition.
|
||||
Task original;
|
||||
if (not addition && get (task.get ("uuid"), original))
|
||||
{
|
||||
// Validate to add metadata.
|
||||
i->validate (false);
|
||||
// Update the task, wherever it is.
|
||||
if (!pending.modify_task (task))
|
||||
completed.modify_task (task);
|
||||
|
||||
// If the task already exists, it is a modification, else addition.
|
||||
Task original;
|
||||
if (get (i->get ("uuid"), original))
|
||||
{
|
||||
// Update the task, wherever it is.
|
||||
if (!pending.modify_task (*i))
|
||||
completed.modify_task (*i);
|
||||
|
||||
// time <time>
|
||||
// old <task>
|
||||
// new <task>
|
||||
// ---
|
||||
undo.add_line ("time " + Date ().toEpochString () + "\n");
|
||||
undo.add_line ("old " + original.composeF4 () + "\n");
|
||||
undo.add_line ("new " + i->composeF4 () + "\n");
|
||||
undo.add_line ("---\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Re-validate to add default values.
|
||||
i->validate ();
|
||||
|
||||
// Add new task to either pending or completed.
|
||||
std::string status = i->get ("status");
|
||||
if (status == "completed" ||
|
||||
status == "deleted")
|
||||
completed.add_task (*i);
|
||||
else
|
||||
pending.add_task (*i);
|
||||
|
||||
// Add undo data lines:
|
||||
// time <time>
|
||||
// new <task>
|
||||
// ---
|
||||
undo.add_line ("time " + Date ().toEpochString () + "\n");
|
||||
undo.add_line ("new " + i->composeF4 () + "\n");
|
||||
undo.add_line ("---\n");
|
||||
}
|
||||
|
||||
// Add task to backlog.
|
||||
if (add_to_backlog)
|
||||
backlog.add_line (i->composeJSON () + "\n");
|
||||
|
||||
// The original task may be further referenced by the caller.
|
||||
if (i->get ("uuid") == uuid)
|
||||
task = *i;
|
||||
// time <time>
|
||||
// old <task>
|
||||
// new <task>
|
||||
// ---
|
||||
undo.add_line ("time " + Date ().toEpochString () + "\n");
|
||||
undo.add_line ("old " + original.composeF4 () + "\n");
|
||||
undo.add_line ("new " + task.composeF4 () + "\n");
|
||||
undo.add_line ("---\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add new task to either pending or completed.
|
||||
std::string status = task.get ("status");
|
||||
if (status == "completed" ||
|
||||
status == "deleted")
|
||||
completed.add_task (task);
|
||||
else
|
||||
pending.add_task (task);
|
||||
|
||||
// Add undo data lines:
|
||||
// time <time>
|
||||
// new <task>
|
||||
// ---
|
||||
undo.add_line ("time " + Date ().toEpochString () + "\n");
|
||||
undo.add_line ("new " + task.composeF4 () + "\n");
|
||||
undo.add_line ("---\n");
|
||||
}
|
||||
|
||||
// Add task to backlog.
|
||||
if (add_to_backlog)
|
||||
backlog.add_line (task.composeJSON () + "\n");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -979,6 +966,9 @@ void TDB2::show_diff (
|
||||
view.add (Column::factory ("string", STRING_TDB2_UNDO_PRIOR));
|
||||
view.add (Column::factory ("string", STRING_TDB2_UNDO_CURRENT));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
Task after (current);
|
||||
|
||||
if (prior != "")
|
||||
@@ -1189,18 +1179,21 @@ int TDB2::gc ()
|
||||
// Allowed as an override, but not recommended.
|
||||
if (context.config.getBoolean ("gc"))
|
||||
{
|
||||
std::vector <Task> pending_tasks = pending.get_tasks ();
|
||||
std::vector <Task> pending_tasks = pending.get_tasks ();
|
||||
|
||||
// TODO Thread.
|
||||
std::vector <Task> completed_tasks = completed.get_tasks ();
|
||||
|
||||
// TODO Assume pending < completed, therefore there is room here to process
|
||||
// data before joining with the completed.data thread.
|
||||
|
||||
bool pending_changes = false;
|
||||
bool completed_changes = false;
|
||||
|
||||
std::vector <Task> pending_tasks_after;
|
||||
std::vector <Task> completed_tasks_after;
|
||||
|
||||
// Reduce unnecessary allocation/copies.
|
||||
pending_tasks_after.reserve (pending_tasks.size ());
|
||||
completed_tasks_after.reserve (completed_tasks.size ());
|
||||
|
||||
// Scan all pending tasks, looking for any that need to be relocated to
|
||||
// completed, or need to be 'woken'.
|
||||
@@ -1237,6 +1230,11 @@ int TDB2::gc ()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Join completed.data thread.
|
||||
|
||||
// Reduce unnecessary allocation/copies.
|
||||
completed_tasks_after.reserve (completed_tasks.size ());
|
||||
|
||||
// Scan all completed tasks, looking for any that need to be relocated to
|
||||
// pending.
|
||||
for (task = completed_tasks.begin ();
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
|
||||
private:
|
||||
void gather_changes ();
|
||||
void update (const std::string&, Task&, const bool, std::vector <Task>&);
|
||||
void update (const std::string&, Task&, const bool, const bool addition = false);
|
||||
bool verifyUniqueUUID (const std::string&);
|
||||
void show_diff (const std::string&, const std::string&, const std::string&);
|
||||
void revert_undo (std::vector <std::string>&, std::string&, std::string&, std::string&, std::string&);
|
||||
|
||||
128
src/Task.cpp
128
src/Task.cpp
@@ -565,7 +565,6 @@ void Task::parse (const std::string& input)
|
||||
nl.getQuoted ('"', value))
|
||||
{
|
||||
legacyAttributeMap (name);
|
||||
legacyValueMap (name, value);
|
||||
|
||||
if (name.substr (0, 11) == "annotation_")
|
||||
++annotation_count;
|
||||
@@ -586,8 +585,6 @@ void Task::parse (const std::string& input)
|
||||
parseJSON (copy);
|
||||
else
|
||||
throw std::string (STRING_RECORD_NOT_FF4);
|
||||
|
||||
upgradeLegacyValues ();
|
||||
}
|
||||
|
||||
catch (const std::string&)
|
||||
@@ -636,8 +633,9 @@ void Task::parseJSON (const std::string& line)
|
||||
// Dates are converted from ISO to epoch.
|
||||
else if (type == "date")
|
||||
{
|
||||
Date d (unquoteText (i->second->dump ()));
|
||||
set (i->first, d.toEpochString ());
|
||||
std::string text = unquoteText (i->second->dump ());
|
||||
Date d (text);
|
||||
set (i->first, text == "" ? "" : d.toEpochString ());
|
||||
}
|
||||
|
||||
// Tags are an array of JSON strings.
|
||||
@@ -718,8 +716,6 @@ void Task::parseJSON (const std::string& line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
upgradeLegacyValues ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -804,6 +800,10 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
||||
if (i->first.substr (0, 11) == "annotation_")
|
||||
continue;
|
||||
|
||||
// If value is an empty string, do not ever output it
|
||||
if (i->second == "")
|
||||
continue;
|
||||
|
||||
if (attributes_written)
|
||||
out << ",";
|
||||
|
||||
@@ -815,16 +815,22 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
||||
if (type == "date")
|
||||
{
|
||||
Date d (i->second);
|
||||
if (i->first == "modification")
|
||||
out << "\"modified\":\""
|
||||
<< d.toISO ()
|
||||
<< "\"";
|
||||
else
|
||||
out << "\""
|
||||
<< i->first
|
||||
<< "\":\""
|
||||
<< d.toISO ()
|
||||
<< "\"";
|
||||
out << "\""
|
||||
<< (i->first == "modification" ? "modified" : i->first)
|
||||
<< "\":\""
|
||||
// Date was deleted, do not export parsed empty string
|
||||
<< (i->second == "" ? "" : d.toISO ())
|
||||
<< "\"";
|
||||
|
||||
++attributes_written;
|
||||
}
|
||||
|
||||
else if (type == "numeric")
|
||||
{
|
||||
out << "\""
|
||||
<< i->first
|
||||
<< "\":"
|
||||
<< i->second;
|
||||
|
||||
++attributes_written;
|
||||
}
|
||||
@@ -847,6 +853,8 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
||||
}
|
||||
|
||||
out << "]";
|
||||
|
||||
++attributes_written;
|
||||
}
|
||||
|
||||
// Everything else is a quoted value.
|
||||
@@ -894,9 +902,8 @@ std::string Task::composeJSON (bool decorate /*= false*/) const
|
||||
// Include urgency.
|
||||
if (decorate)
|
||||
out << ","
|
||||
<< "\"urgency\":\""
|
||||
<< urgency_c ()
|
||||
<<"\"";
|
||||
<< "\"urgency\":"
|
||||
<< urgency_c ();
|
||||
#endif
|
||||
|
||||
out << "}";
|
||||
@@ -1093,6 +1100,7 @@ int Task::getTagCount () const
|
||||
bool Task::hasTag (const std::string& tag) const
|
||||
{
|
||||
// Synthetic tags - dynamically generated, but do not occupy storage space.
|
||||
// Note: This list must match that in CmdInfo::execute.
|
||||
if (tag == "BLOCKED") return is_blocked;
|
||||
if (tag == "UNBLOCKED") return !is_blocked;
|
||||
if (tag == "BLOCKING") return is_blocking;
|
||||
@@ -1112,10 +1120,10 @@ bool Task::hasTag (const std::string& tag) const
|
||||
if (tag == "SCHEDULED") return has ("scheduled");
|
||||
if (tag == "CHILD") return has ("parent");
|
||||
if (tag == "UNTIL") return has ("until");
|
||||
if (tag == "WAITING") return has ("wait");
|
||||
if (tag == "ANNOTATED") return hasAnnotations ();
|
||||
if (tag == "TAGGED") return has ("tags");
|
||||
if (tag == "PARENT") return has ("mask");
|
||||
if (tag == "WAITING") return get ("status") == "waiting";
|
||||
if (tag == "PENDING") return get ("status") == "pending";
|
||||
if (tag == "COMPLETED") return get ("status") == "completed";
|
||||
if (tag == "DELETED") return get ("status") == "deleted";
|
||||
@@ -2068,9 +2076,6 @@ void Task::modify (modType type, bool text_required /* = false */)
|
||||
if (v.type () == Variant::type_string)
|
||||
throw format (STRING_UDA_NUMERIC, v.get_string ());
|
||||
|
||||
v.cast (Variant::type_real);
|
||||
v.cast (Variant::type_string);
|
||||
|
||||
set (name, v);
|
||||
++modCount;
|
||||
}
|
||||
@@ -2209,78 +2214,3 @@ void Task::modify (modType type, bool text_required /* = false */)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::upgradeLegacyValues ()
|
||||
{
|
||||
// 2.4.0 Update recurrence values.
|
||||
if (has ("recur"))
|
||||
{
|
||||
std::string value = get ("recur");
|
||||
if (value != "")
|
||||
{
|
||||
std::string new_value = value;
|
||||
upgradeLegacyValue (new_value);
|
||||
|
||||
if (new_value != value)
|
||||
{
|
||||
set ("recur", new_value);
|
||||
context.debug (format ("Legacy upgrade: recur {1} --> {2}", value, new_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2.4.0 Update UDA duration values.
|
||||
Config::const_iterator name;
|
||||
for (name = context.config.begin (); name != context.config.end (); ++name)
|
||||
{
|
||||
if (name->first.substr (0, 4) == "uda." &&
|
||||
name->first.find (".type") != std::string::npos)
|
||||
{
|
||||
if (name->second == "duration")
|
||||
{
|
||||
std::string::size_type period = name->first.find ('.', 4);
|
||||
if (period != std::string::npos)
|
||||
{
|
||||
std::string uda = name->first.substr (4, period - 4);
|
||||
std::string value = get (uda);
|
||||
std::string new_value = value;
|
||||
upgradeLegacyValue (new_value);
|
||||
|
||||
if (new_value != value)
|
||||
{
|
||||
set ("recur", new_value);
|
||||
context.debug (format ("Legacy upgrade: UDA {1}, {2} --> {3}", uda, value, new_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::upgradeLegacyValue (std::string& value)
|
||||
{
|
||||
std::string::size_type len = value.length ();
|
||||
std::string::size_type p;
|
||||
|
||||
if (value == "-") value = "0s";
|
||||
else if ((p = value.find ("hr")) != std::string::npos && p == len - 2) value = value.substr (0, p) + "h";
|
||||
else if ((p = value.find ("hrs")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "h";
|
||||
else if ((p = value.find ("mins")) != std::string::npos && p == len - 4) value = value.substr (0, p) + "min";
|
||||
else if ((p = value.find ("mnths")) != std::string::npos && p == len - 5) value = value.substr (0, p) + "mo";
|
||||
else if ((p = value.find ("mos")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "mo";
|
||||
else if ((p = value.find ("mth")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "mo";
|
||||
else if ((p = value.find ("mths")) != std::string::npos && p == len - 4) value = value.substr (0, p) + "mo";
|
||||
else if ((p = value.find ("qrtrs")) != std::string::npos && p == len - 5) value = value.substr (0, p) + "q";
|
||||
else if ((p = value.find ("qtr")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "q";
|
||||
else if ((p = value.find ("qtrs")) != std::string::npos && p == len - 4) value = value.substr (0, p) + "q";
|
||||
else if ((p = value.find ("sec")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "s";
|
||||
else if ((p = value.find ("secs")) != std::string::npos && p == len - 4) value = value.substr (0, p) + "s";
|
||||
else if ((p = value.find ("wk")) != std::string::npos && p == len - 2) value = value.substr (0, p) + "w";
|
||||
else if ((p = value.find ("wks")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "w";
|
||||
else if ((p = value.find ("yr")) != std::string::npos && p == len - 2) value = value.substr (0, p) + "y";
|
||||
else if ((p = value.find ("yrs")) != std::string::npos && p == len - 3) value = value.substr (0, p) + "y";
|
||||
|
||||
// It is not an error to have a non-legacy value.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -154,7 +154,6 @@ public:
|
||||
|
||||
enum modType {modReplace, modPrepend, modAppend, modAnnotate};
|
||||
void modify (modType, bool text_required = false);
|
||||
void upgradeLegacyValues ();
|
||||
|
||||
private:
|
||||
int determineVersion (const std::string&);
|
||||
@@ -163,7 +162,6 @@ private:
|
||||
void validate_before (const std::string&, const std::string&);
|
||||
const std::string encode (const std::string&) const;
|
||||
const std::string decode (const std::string&) const;
|
||||
void upgradeLegacyValue (std::string&);
|
||||
|
||||
public:
|
||||
float urgency_priority () const;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
std::string Variant::dateFormat = "";
|
||||
bool Variant::searchCaseSensitive = true;
|
||||
bool Variant::searchUsingRegex = true;
|
||||
bool Variant::isoEnabled = true;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Variant::Variant ()
|
||||
@@ -2065,7 +2066,8 @@ void Variant::cast (const enum type new_type)
|
||||
|
||||
ISO8601d iso;
|
||||
std::string::size_type pos = 0;
|
||||
if (iso.parse (_string, pos) &&
|
||||
if (isoEnabled &&
|
||||
iso.parse (_string, pos) &&
|
||||
pos == _string.length ())
|
||||
{
|
||||
_date = (time_t) iso;
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
static std::string dateFormat;
|
||||
static bool searchCaseSensitive;
|
||||
static bool searchUsingRegex;
|
||||
static bool isoEnabled;
|
||||
|
||||
enum type {type_unknown, type_boolean, type_integer, type_real, type_string,
|
||||
type_date, type_duration};
|
||||
|
||||
@@ -57,7 +57,7 @@ int main (int argc, char** argv)
|
||||
try
|
||||
{
|
||||
bool infix = true;
|
||||
bool ambiguous = true;
|
||||
bool ambiguous = false;
|
||||
|
||||
// Add a source for constants.
|
||||
Eval e;
|
||||
@@ -77,8 +77,8 @@ int main (int argc, char** argv)
|
||||
<< " -d|--debug Debug mode\n"
|
||||
<< " -i|--infix Infix expression (default)\n"
|
||||
<< " -p|--postfix Postfix expression\n"
|
||||
<< " -a|--ambiguous Choose dates over numbers when ambiguous (default)\n"
|
||||
<< " -n|--noambiguous Choose numbers over dates when ambiguous\n"
|
||||
<< " -a|--ambiguous Choose dates over numbers when ambiguous\n"
|
||||
<< " -n|--noambiguous Choose numbers over dates when ambiguous (default)\n"
|
||||
<< "\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@@ -207,8 +207,6 @@ void ColumnDate::render (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
Duration (date - now).format (), width)));
|
||||
else
|
||||
lines.push_back (rightJustify ("", width));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class ColumnDate : public Column
|
||||
{
|
||||
public:
|
||||
ColumnDate ();
|
||||
~ColumnDate ();
|
||||
virtual ~ColumnDate ();
|
||||
|
||||
virtual bool validate (std::string&);
|
||||
virtual void measure (Task&, unsigned int&, unsigned int&);
|
||||
|
||||
@@ -62,11 +62,16 @@ bool ColumnIMask::validate (std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnIMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = task.get ("imask").length ();
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (_style != "default" &&
|
||||
_style != "number")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
if (task.has (_name))
|
||||
{
|
||||
minimum = maximum = task.get ("imask").length ();
|
||||
|
||||
if (_style != "default" &&
|
||||
_style != "number")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -76,7 +81,8 @@ void ColumnIMask::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
lines.push_back (color.colorize (rightJustify (task.get ("imask"), width)));
|
||||
if (task.has (_name))
|
||||
lines.push_back (color.colorize (rightJustify (task.get ("imask"), width)));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -62,10 +62,14 @@ bool ColumnMask::validate (std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnMask::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = task.get ("mask").length ();
|
||||
minimum = maximum = 0;
|
||||
if (task.has (_name))
|
||||
{
|
||||
minimum = maximum = task.get ("mask").length ();
|
||||
|
||||
if (_style != "default")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
if (_style != "default")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -75,7 +79,8 @@ void ColumnMask::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
lines.push_back (color.colorize (task.get ("mask")));
|
||||
if (task.has (_name))
|
||||
lines.push_back (color.colorize (task.get ("mask")));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -62,12 +62,17 @@ bool ColumnParent::validate (std::string& value)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnParent::measure (Task&, unsigned int& minimum, unsigned int& maximum)
|
||||
void ColumnParent::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||
else if (_style == "short") minimum = maximum = 8;
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "default" || _style == "long") minimum = maximum = 36;
|
||||
else if (_style == "short") minimum = maximum = 8;
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -77,20 +82,23 @@ void ColumnParent::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
||||
// 34f00694 short
|
||||
if (_style == "default" ||
|
||||
_style == "long")
|
||||
if (task.has (_name))
|
||||
{
|
||||
lines.push_back (color.colorize (leftJustify (task.get (_name), width)));
|
||||
}
|
||||
// f30cb9c3-3fc0-483f-bfb2-3bf134f00694 default
|
||||
// 34f00694 short
|
||||
if (_style == "default" ||
|
||||
_style == "long")
|
||||
{
|
||||
lines.push_back (color.colorize (leftJustify (task.get (_name), width)));
|
||||
}
|
||||
|
||||
else if (_style == "short")
|
||||
{
|
||||
if (task.has (_name))
|
||||
lines.push_back (color.colorize (leftJustify (task.get (_name).substr (28), width)));
|
||||
else
|
||||
lines.push_back (color.colorize (leftJustify ("", width)));
|
||||
else if (_style == "short")
|
||||
{
|
||||
if (task.has (_name))
|
||||
lines.push_back (color.colorize (leftJustify (task.get (_name).substr (28), width)));
|
||||
else
|
||||
lines.push_back (color.colorize (leftJustify ("", width)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,17 +53,14 @@ ColumnPriority::~ColumnPriority ()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Allow lower case, but implicitly convert.
|
||||
bool ColumnPriority::validate (std::string& value)
|
||||
{
|
||||
value = upperCase (value);
|
||||
if (value == "h") { value = "H"; return true; }
|
||||
else if (value == "m") { value = "M"; return true; }
|
||||
else if (value == "l") { value = "L"; return true; }
|
||||
|
||||
if (value == "H" ||
|
||||
value == "M" ||
|
||||
value == "L" ||
|
||||
value == "")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return value == "H" || value == "M" || value == "L" || value == "";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -81,22 +78,26 @@ void ColumnPriority::setStyle (const std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnPriority::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
std::string priority = task.get (_name);
|
||||
|
||||
if (priority == "")
|
||||
minimum = maximum = 0;
|
||||
else
|
||||
minimum = maximum = 1;
|
||||
|
||||
if (_style == "long")
|
||||
minimum = maximum = 0;
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (priority == "H") minimum = maximum = 4;
|
||||
else if (priority == "M") minimum = maximum = 6;
|
||||
else if (priority == "L") minimum = maximum = 3;
|
||||
std::string priority = task.get (_name);
|
||||
|
||||
if (priority == "")
|
||||
minimum = maximum = 0;
|
||||
else
|
||||
minimum = maximum = 1;
|
||||
|
||||
if (_style == "long")
|
||||
{
|
||||
if (priority == "H") minimum = maximum = 4;
|
||||
else if (priority == "M") minimum = maximum = 6;
|
||||
else if (priority == "L") minimum = maximum = 3;
|
||||
}
|
||||
else if (_style != "default" &&
|
||||
_style != "short")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
||||
}
|
||||
else if (_style != "default" &&
|
||||
_style != "short")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, "priority", _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -106,21 +107,28 @@ void ColumnPriority::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
std::string priority = task.get (_name);
|
||||
if (_style == "long")
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (priority == "H") priority = "High";
|
||||
else if (priority == "M") priority = "Medium";
|
||||
else if (priority == "L") priority = "Low";
|
||||
}
|
||||
std::string priority = task.get (_name);
|
||||
if (_style == "long")
|
||||
{
|
||||
if (priority == "H") priority = "High";
|
||||
else if (priority == "M") priority = "Medium";
|
||||
else if (priority == "L") priority = "Low";
|
||||
}
|
||||
|
||||
lines.push_back (color.colorize (leftJustify (priority, width)));
|
||||
lines.push_back (color.colorize (leftJustify (priority, width)));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string ColumnPriority::modify (std::string& value)
|
||||
{
|
||||
return upperCase (value);
|
||||
if (value == "h") value = "H";
|
||||
else if (value == "m") value = "M";
|
||||
else if (value == "l") value = "L";
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -68,25 +68,30 @@ bool ColumnProject::validate (std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnProject::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
std::string project = task.get (_name);
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (_style == "parent")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
else if (_style == "indented")
|
||||
{
|
||||
project = indentProject (project, " ", '.');
|
||||
}
|
||||
else if (_style != "default" &&
|
||||
_style != "full" &&
|
||||
_style != "indented")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
std::string project = task.get (_name);
|
||||
|
||||
minimum = longestWord (project);
|
||||
maximum = utf8_width (project);
|
||||
if (_style == "parent")
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
else if (_style == "indented")
|
||||
{
|
||||
project = indentProject (project, " ", '.');
|
||||
}
|
||||
else if (_style != "default" &&
|
||||
_style != "full" &&
|
||||
_style != "indented")
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
|
||||
minimum = longestWord (project);
|
||||
maximum = utf8_width (project);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -96,24 +101,27 @@ void ColumnProject::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
std::string project = task.get (_name);
|
||||
if (_style == "parent")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
else if (_style == "indented")
|
||||
{
|
||||
project = indentProject (project, " ", '.');
|
||||
}
|
||||
std::string project = task.get (_name);
|
||||
if (_style == "parent")
|
||||
{
|
||||
std::string::size_type period = project.find ('.');
|
||||
if (period != std::string::npos)
|
||||
project = project.substr (0, period);
|
||||
}
|
||||
else if (_style == "indented")
|
||||
{
|
||||
project = indentProject (project, " ", '.');
|
||||
}
|
||||
|
||||
std::vector <std::string> raw;
|
||||
wrapText (raw, project, width, _hyphenate);
|
||||
std::vector <std::string> raw;
|
||||
wrapText (raw, project, width, _hyphenate);
|
||||
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = raw.begin (); i != raw.end (); ++i)
|
||||
lines.push_back (color.colorize (leftJustify (*i, width)));
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = raw.begin (); i != raw.end (); ++i)
|
||||
lines.push_back (color.colorize (leftJustify (*i, width)));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -79,18 +79,23 @@ void ColumnRecur::setStyle (const std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnRecur::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
if (_style == "default" ||
|
||||
_style == "duration")
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (task.has (_name))
|
||||
{
|
||||
minimum = maximum = Duration (task.get ("recur")).formatISO ().length ();
|
||||
if (_style == "default" ||
|
||||
_style == "duration")
|
||||
{
|
||||
minimum = maximum = Duration (task.get ("recur")).formatISO ().length ();
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
minimum = maximum = utf8_width (context.config.get ("recurrence.indicator"));
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -108,8 +113,7 @@ void ColumnRecur::render (
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
Duration (task.get ("recur")).formatISO (),
|
||||
width)));
|
||||
Duration (task.get ("recur")).formatISO (), width)));
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
|
||||
@@ -71,6 +71,8 @@ void ColumnString::setReport (const std::string& value)
|
||||
//
|
||||
void ColumnString::measure (const std::string& value, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (_style == "left" ||
|
||||
_style == "right" ||
|
||||
_style == "default")
|
||||
|
||||
@@ -84,30 +84,34 @@ void ColumnTags::setStyle (const std::string& value)
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnTags::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
|
||||
{
|
||||
if (_style == "indicator") minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
|
||||
else if (_style == "count") minimum = maximum = 3;
|
||||
else if (_style == "default" ||
|
||||
_style == "list")
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
minimum = 0;
|
||||
maximum = utf8_width (tags);
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (maximum)
|
||||
if (task.has (_name))
|
||||
{
|
||||
if (_style == "indicator") minimum = maximum = utf8_width (context.config.get ("tag.indicator"));
|
||||
else if (_style == "count") minimum = maximum = 3;
|
||||
else if (_style == "default" ||
|
||||
_style == "list")
|
||||
{
|
||||
std::vector <std::string> all;
|
||||
split (all, tags, ',');
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = all.begin (); i != all.end (); ++i)
|
||||
std::string tags = task.get (_name);
|
||||
maximum = utf8_width (tags);
|
||||
|
||||
if (maximum)
|
||||
{
|
||||
unsigned int length = utf8_width (*i);
|
||||
if (length > minimum)
|
||||
minimum = length;
|
||||
std::vector <std::string> all;
|
||||
split (all, tags, ',');
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = all.begin (); i != all.end (); ++i)
|
||||
{
|
||||
unsigned int length = utf8_width (*i);
|
||||
if (length > minimum)
|
||||
minimum = length;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -117,9 +121,9 @@ void ColumnTags::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
if (tags != "")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string tags = task.get (_name);
|
||||
if (_style == "default" ||
|
||||
_style == "list")
|
||||
{
|
||||
|
||||
@@ -80,49 +80,52 @@ void ColumnUDA::measure (Task& task, unsigned int& minimum, unsigned int& maximu
|
||||
{
|
||||
minimum = maximum = 0;
|
||||
|
||||
if (_style == "default")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string value = task.get (_name);
|
||||
if (value != "")
|
||||
if (_style == "default")
|
||||
{
|
||||
if (_type == "date")
|
||||
std::string value = task.get (_name);
|
||||
if (value != "")
|
||||
{
|
||||
// Determine the output date format, which uses a hierarchy of definitions.
|
||||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat
|
||||
Date date ((time_t) strtol (value.c_str (), NULL, 10));
|
||||
std::string format = context.config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
if (_type == "date")
|
||||
{
|
||||
// Determine the output date format, which uses a hierarchy of definitions.
|
||||
// rc.report.<report>.dateformat
|
||||
// rc.dateformat.report
|
||||
// rc.dateformat
|
||||
Date date ((time_t) strtol (value.c_str (), NULL, 10));
|
||||
std::string format = context.config.get ("report." + _report + ".dateformat");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat.report");
|
||||
if (format == "")
|
||||
format = context.config.get ("dateformat");
|
||||
|
||||
minimum = maximum = Date::length (format);
|
||||
}
|
||||
else if (_type == "duration")
|
||||
{
|
||||
minimum = maximum = utf8_width (Duration (value).formatISO ());
|
||||
}
|
||||
else if (_type == "string")
|
||||
{
|
||||
std::string stripped = Color::strip (value);
|
||||
maximum = longestLine (stripped);
|
||||
minimum = longestWord (stripped);
|
||||
}
|
||||
else if (_type == "numeric")
|
||||
{
|
||||
minimum = maximum = utf8_width (value);
|
||||
minimum = maximum = Date::length (format);
|
||||
}
|
||||
else if (_type == "duration")
|
||||
{
|
||||
minimum = maximum = utf8_width (Duration (value).formatISO ());
|
||||
}
|
||||
else if (_type == "string")
|
||||
{
|
||||
std::string stripped = Color::strip (value);
|
||||
maximum = longestLine (stripped);
|
||||
minimum = longestWord (stripped);
|
||||
}
|
||||
else if (_type == "numeric")
|
||||
{
|
||||
minimum = maximum = utf8_width (value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator"));
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
minimum = maximum = utf8_width (context.config.get ("uda." + _name + ".indicator"));
|
||||
}
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -132,11 +135,11 @@ void ColumnUDA::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
if (_style == "default")
|
||||
if (task.has (_name))
|
||||
{
|
||||
std::string value = task.get (_name);
|
||||
if (value != "")
|
||||
if (_style == "default")
|
||||
{
|
||||
std::string value = task.get (_name);
|
||||
if (_type == "date")
|
||||
{
|
||||
// Determine the output date format, which uses a hierarchy of definitions.
|
||||
@@ -177,13 +180,13 @@ void ColumnUDA::render (
|
||||
lines.push_back (color.colorize (rightJustify (value, width)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
|
||||
else if (_style == "indicator")
|
||||
{
|
||||
if (task.has (_name))
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (context.config.get ("uda." + _name + ".indicator"), width)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ set (commands_SRCS Command.cpp Command.h
|
||||
CmdColor.cpp CmdColor.h
|
||||
CmdColumns.cpp CmdColumns.h
|
||||
CmdConfig.cpp CmdConfig.h
|
||||
CmdContext.cpp CmdContext.h
|
||||
CmdCount.cpp CmdCount.h
|
||||
CmdCustom.cpp CmdCustom.h
|
||||
CmdDelete.cpp CmdDelete.h
|
||||
|
||||
@@ -284,6 +284,7 @@ int CmdCalendar::execute (std::string& output)
|
||||
Color color_weekend (context.config.get ("color.calendar.weekend"));
|
||||
Color color_holiday (context.config.get ("color.calendar.holiday"));
|
||||
Color color_weeknumber (context.config.get ("color.calendar.weeknumber"));
|
||||
Color color_label (context.config.get ("color.label"));
|
||||
|
||||
if (context.color () && context.config.getBoolean ("calendar.legend"))
|
||||
out << "Legend: "
|
||||
@@ -342,7 +343,6 @@ int CmdCalendar::execute (std::string& output)
|
||||
executable = executable.substr (0, cal) + PACKAGE;
|
||||
|
||||
std::vector <std::string> args;
|
||||
args.push_back (executable);
|
||||
args.push_back ("rc:" + context.rc_file._data);
|
||||
args.push_back ("rc.due:0");
|
||||
args.push_back ("rc.verbose:label,affected,blank");
|
||||
@@ -363,6 +363,7 @@ int CmdCalendar::execute (std::string& output)
|
||||
holTable.width (context.getWidth ());
|
||||
holTable.add (Column::factory ("string", STRING_CMD_CAL_LABEL_DATE));
|
||||
holTable.add (Column::factory ("string", STRING_CMD_CAL_LABEL_HOL));
|
||||
holTable.colorHeader (color_label);
|
||||
|
||||
Config::const_iterator it;
|
||||
std::map <time_t, std::vector<std::string> > hm; // we need to store multiple holidays per day
|
||||
@@ -426,7 +427,10 @@ std::string CmdCalendar::renderMonths (
|
||||
throw std::string (STRING_CMD_CAL_SUN_MON);
|
||||
|
||||
// Build table for the number of months to be displayed.
|
||||
Color label (context.config.get ("color.label"));
|
||||
|
||||
ViewText view;
|
||||
view.colorHeader (label);
|
||||
view.width (context.getWidth ());
|
||||
for (int i = 0 ; i < (monthsPerLine * 8); i += 8)
|
||||
{
|
||||
|
||||
@@ -70,6 +70,9 @@ int CmdColumns::execute (std::string& output)
|
||||
formats.add (Column::factory ("string", STRING_COLUMN_LABEL_STYLES));
|
||||
formats.add (Column::factory ("string", STRING_COLUMN_LABEL_EXAMPLES));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
formats.colorHeader (label);
|
||||
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
formats.colorOdd (alternate);
|
||||
formats.intraColorOdd (alternate);
|
||||
|
||||
@@ -46,6 +46,107 @@ CmdConfig::CmdConfig ()
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool CmdConfig::setConfigVariable (std::string name, std::string value, bool confirmation /* = false */)
|
||||
{
|
||||
// Read .taskrc (or equivalent)
|
||||
std::vector <std::string> contents;
|
||||
File::read (context.config._original_file, contents);
|
||||
|
||||
bool found = false;
|
||||
bool change = false;
|
||||
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = contents.begin (); line != contents.end (); ++line)
|
||||
{
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line->find ("#");
|
||||
std::string::size_type pos = line->find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
comment > pos))
|
||||
{
|
||||
found = true;
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
|
||||
{
|
||||
if (comment != std::string::npos)
|
||||
*line = name + "=" + json::encode (value) + " " + line->substr (comment);
|
||||
else
|
||||
*line = name + "=" + json::encode (value);
|
||||
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not found, so append instead.
|
||||
if (!found &&
|
||||
(!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))))
|
||||
{
|
||||
contents.push_back (name + "=" + json::encode (value));
|
||||
change = true;
|
||||
}
|
||||
|
||||
if (change)
|
||||
File::write (context.config._original_file, contents);
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdConfig::unsetConfigVariable (std::string name, bool confirmation /* = false */)
|
||||
{
|
||||
// Read .taskrc (or equivalent)
|
||||
std::vector <std::string> contents;
|
||||
File::read (context.config._original_file, contents);
|
||||
|
||||
bool found = false;
|
||||
bool change = false;
|
||||
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = contents.begin (); line != contents.end (); )
|
||||
{
|
||||
bool lineDeleted = false;
|
||||
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line->find ("#");
|
||||
std::string::size_type pos = line->find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
comment > pos))
|
||||
{
|
||||
found = true;
|
||||
|
||||
// Remove name
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM3, name)))
|
||||
{
|
||||
// vector::erase method returns a valid iterator to the next object
|
||||
line = contents.erase (line);
|
||||
lineDeleted = true;
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! lineDeleted)
|
||||
line++;
|
||||
}
|
||||
|
||||
if (change)
|
||||
File::write (context.config._original_file, contents);
|
||||
|
||||
if ( change && found )
|
||||
return 0;
|
||||
else if ( found )
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdConfig::execute (std::string& output)
|
||||
{
|
||||
@@ -62,10 +163,13 @@ int CmdConfig::execute (std::string& output)
|
||||
if (words.size ())
|
||||
{
|
||||
bool confirmation = context.config.getBoolean ("confirmation");
|
||||
bool change = false;
|
||||
bool found = false;
|
||||
|
||||
std::string name = words[0];
|
||||
std::string value = "";
|
||||
|
||||
// Join the remaining words into config variable's value
|
||||
if (words.size () > 1)
|
||||
{
|
||||
for (unsigned int i = 1; i < words.size (); ++i)
|
||||
@@ -81,85 +185,30 @@ int CmdConfig::execute (std::string& output)
|
||||
{
|
||||
bool change = false;
|
||||
|
||||
// Read .taskrc (or equivalent)
|
||||
std::vector <std::string> contents;
|
||||
File::read (context.config._original_file, contents);
|
||||
|
||||
// task config name value
|
||||
// task config name ""
|
||||
if (words.size () > 1)
|
||||
{
|
||||
bool found = false;
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = contents.begin (); line != contents.end (); ++line)
|
||||
{
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line->find ("#");
|
||||
std::string::size_type pos = line->find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
comment > pos))
|
||||
{
|
||||
found = true;
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
|
||||
{
|
||||
if (comment != std::string::npos)
|
||||
*line = name + "=" + json::encode (value) + " " + line->substr (comment);
|
||||
else
|
||||
*line = name + "=" + json::encode (value);
|
||||
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Not found, so append instead.
|
||||
if (!found &&
|
||||
(!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))))
|
||||
{
|
||||
contents.push_back (name + "=" + json::encode (value));
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
change = setConfigVariable(name, value, confirmation);
|
||||
|
||||
// task config name
|
||||
else
|
||||
{
|
||||
bool found = false;
|
||||
std::vector <std::string>::iterator line;
|
||||
for (line = contents.begin (); line != contents.end (); ++line)
|
||||
rc = unsetConfigVariable(name, confirmation);
|
||||
if (rc == 0)
|
||||
{
|
||||
// If there is a comment on the line, it must follow the pattern.
|
||||
std::string::size_type comment = line->find ("#");
|
||||
std::string::size_type pos = line->find (name + "=");
|
||||
|
||||
if (pos != std::string::npos &&
|
||||
(comment == std::string::npos ||
|
||||
comment > pos))
|
||||
{
|
||||
found = true;
|
||||
|
||||
// Remove name
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM3, name)))
|
||||
{
|
||||
*line = "";
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
change = true;
|
||||
found = true;
|
||||
}
|
||||
else if (rc == 1)
|
||||
found = true;
|
||||
|
||||
if (!found)
|
||||
throw format (STRING_CMD_CONFIG_NO_ENTRY, name);
|
||||
}
|
||||
|
||||
// Write .taskrc (or equivalent)
|
||||
// Show feedback depending on whether .taskrc has been rewritten
|
||||
if (change)
|
||||
{
|
||||
File::write (context.config._original_file, contents);
|
||||
out << format (STRING_CMD_CONFIG_FILE_MOD,
|
||||
context.config._original_file._data)
|
||||
<< "\n";
|
||||
|
||||
@@ -34,6 +34,8 @@ class CmdConfig : public Command
|
||||
{
|
||||
public:
|
||||
CmdConfig ();
|
||||
static bool setConfigVariable (std::string name, std::string value, bool confirmation = false);
|
||||
static int unsetConfigVariable (std::string name, bool confirmation = false);
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
|
||||
379
src/commands/CmdContext.cpp
Normal file
379
src/commands/CmdContext.cpp
Normal file
@@ -0,0 +1,379 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2006 - 2015, 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 <Context.h>
|
||||
#include <Filter.h>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <i18n.h>
|
||||
#include <util.h>
|
||||
#include <text.h>
|
||||
#include <CmdContext.h>
|
||||
#include <CmdConfig.h>
|
||||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdContext::CmdContext ()
|
||||
{
|
||||
_keyword = "context";
|
||||
_usage = "task context [<name> | subcommand]";
|
||||
_description = STRING_CMD_CONTEXT_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdContext::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
std::stringstream out;
|
||||
|
||||
// Get the non-attribute, non-fancy command line arguments.
|
||||
std::vector <std::string> words = context.cli.getWords ();
|
||||
|
||||
if (words.size () > 0)
|
||||
{
|
||||
std::string subcommand = words[0];
|
||||
|
||||
if (subcommand == "define")
|
||||
rc = defineContext (words, out);
|
||||
else if (subcommand == "delete")
|
||||
rc = deleteContext (words, out);
|
||||
else if (subcommand == "list")
|
||||
rc = listContexts (words, out);
|
||||
else if (subcommand == "none")
|
||||
rc = unsetContext (words, out);
|
||||
else if (subcommand == "show")
|
||||
rc = showContext (words, out);
|
||||
else
|
||||
rc = setContext (words, out);
|
||||
}
|
||||
|
||||
output = out.str ();
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Joins all the words in the specified interval <from, to) to one string,
|
||||
// which is then returned.
|
||||
//
|
||||
// If to is specified as 0 (default value), all the remaining words will be joined.
|
||||
//
|
||||
std::string CmdContext::joinWords (std::vector <std::string>& words, unsigned int from, unsigned int to /* = 0 */)
|
||||
{
|
||||
std::string value = "";
|
||||
|
||||
if (to == 0)
|
||||
to = words.size();
|
||||
|
||||
for (unsigned int i = from; i < to; ++i)
|
||||
{
|
||||
if (i > from)
|
||||
value += " ";
|
||||
|
||||
value += words[i];
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Returns all user defined contexts.
|
||||
//
|
||||
std::vector <std::string> CmdContext::getContexts ()
|
||||
{
|
||||
std::vector <std::string> contexts;
|
||||
|
||||
Config::const_iterator name;
|
||||
for (name = context.config.begin (); name != context.config.end (); ++name)
|
||||
if (name->first.substr (0, 8) == "context.")
|
||||
contexts.push_back (name->first.substr (8));
|
||||
|
||||
return contexts;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Defines a new user-provided context.
|
||||
// - The context definition is written into .taskrc as a context.<name> variable.
|
||||
// - Deletion of the context requires confirmation if rc.confirmation=yes.
|
||||
//
|
||||
// Returns: 0 if the addition of the config variable was successful, 1 otherwise
|
||||
//
|
||||
// Invoked with: task context define <name> <filter>
|
||||
// Example: task context define home project:Home
|
||||
//
|
||||
int CmdContext::defineContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
int rc = 0;
|
||||
bool confirmation = context.config.getBoolean ("confirmation");
|
||||
|
||||
if (words.size () > 2)
|
||||
{
|
||||
std::string name = "context." + words[1];
|
||||
std::string value = joinWords (words, 2);
|
||||
|
||||
// Check if the value is a proper filter by filtering current pending.data
|
||||
Filter filter;
|
||||
std::vector <Task> filtered;
|
||||
const std::vector <Task>& pending = context.tdb2.pending.get_tasks ();
|
||||
|
||||
try
|
||||
{
|
||||
context.cli.addRawFilter ("( " + value + " )");
|
||||
filter.subset (pending, filtered);
|
||||
}
|
||||
catch (std::string exception)
|
||||
{
|
||||
throw format (STRING_CMD_CONTEXT_DEF_ABRT2, exception);
|
||||
}
|
||||
|
||||
// Make user explicitly confirm filters that are matching no pending tasks
|
||||
if (filtered.size () == 0)
|
||||
if (confirmation &&
|
||||
! confirm (format (STRING_CMD_CONTEXT_DEF_CONF, value)))
|
||||
throw std::string (STRING_CMD_CONTEXT_DEF_ABRT);
|
||||
|
||||
// Set context definition config variable
|
||||
bool success = CmdConfig::setConfigVariable (name, value, confirmation);
|
||||
|
||||
if (success)
|
||||
out << format (STRING_CMD_CONTEXT_DEF_SUCC, words[1]) << "\n";
|
||||
else
|
||||
{
|
||||
out << format (STRING_CMD_CONTEXT_DEF_FAIL, words[1]) << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out << STRING_CMD_CONTEXT_DEF_USAG << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Deletes the specified context.
|
||||
// - If the deleted context is currently active, unset it.
|
||||
// - Deletion of the context requires confirmation if rc.confirmation=yes.
|
||||
//
|
||||
// Returns: 0 if the removal of the config variable was successful, 1 otherwise
|
||||
//
|
||||
// Invoked with: task context delete <name>
|
||||
// Example: task context delete home
|
||||
//
|
||||
int CmdContext::deleteContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (words.size () > 1)
|
||||
{
|
||||
// Delete the specified context
|
||||
std::string name = "context." + words[1];
|
||||
|
||||
bool confirmation = context.config.getBoolean ("confirmation");
|
||||
rc = CmdConfig::unsetConfigVariable(name, confirmation);
|
||||
|
||||
// If the currently set context was deleted, unset it
|
||||
std::string currentContext = context.config.get ("context");
|
||||
|
||||
if (currentContext == words[1])
|
||||
CmdConfig::unsetConfigVariable("context", false);
|
||||
|
||||
// Output feedback
|
||||
if (rc == 0)
|
||||
out << format (STRING_CMD_CONTEXT_DEL_SUCC, words[1]) << "\n";
|
||||
else
|
||||
out << format (STRING_CMD_CONTEXT_DEL_FAIL, words[1]) << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
out << STRING_CMD_CONTEXT_DEL_USAG << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Render a list of context names and their definitions.
|
||||
//
|
||||
// Returns: 0 the resulting list is non-empty, 1 otherwise
|
||||
//
|
||||
// Invoked with: task context list
|
||||
// Example: task context list
|
||||
//
|
||||
int CmdContext::listContexts (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
int rc = 0;
|
||||
std::vector <std::string> contexts = getContexts();
|
||||
|
||||
if (contexts.size ())
|
||||
{
|
||||
std::sort (contexts.begin (), contexts.end ());
|
||||
|
||||
ViewText view;
|
||||
view.width (context.getWidth ());
|
||||
view.add (Column::factory ("string", "Name"));
|
||||
view.add (Column::factory ("string", "Definition"));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
std::vector <std::string>::iterator userContext;
|
||||
for (userContext = contexts.begin (); userContext != contexts.end (); ++userContext)
|
||||
{
|
||||
std::string definition = context.config.get ("context." + *userContext);
|
||||
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, *userContext);
|
||||
view.set (row, 1, definition);
|
||||
}
|
||||
|
||||
out << optionalBlankLine ()
|
||||
<< view.render ()
|
||||
<< optionalBlankLine ();
|
||||
}
|
||||
else
|
||||
{
|
||||
out << STRING_CMD_CONTEXT_LIST_EMPT << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Sets the specified context as currently active.
|
||||
// - If some other context was active, the value of currently active context
|
||||
// is replaced, not added.
|
||||
// - Setting of the context does not require confirmation.
|
||||
//
|
||||
// Returns: 0 if the setting of the context was successful, 1 otherwise
|
||||
//
|
||||
// Invoked with: task context <name>
|
||||
// Example: task context home
|
||||
//
|
||||
int CmdContext::setContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
int rc = 0;
|
||||
std::string value = words[0];
|
||||
std::vector <std::string> contexts = getContexts ();
|
||||
|
||||
// Check that the specified context is defined
|
||||
if (std::find (contexts.begin (), contexts.end (), value) == contexts.end ())
|
||||
throw format (STRING_CMD_CONTEXT_SET_NFOU, value);
|
||||
|
||||
// Set the active context.
|
||||
// Should always succeed, as we do not require confirmation.
|
||||
bool success = CmdConfig::setConfigVariable ("context", value, false);
|
||||
|
||||
if (success)
|
||||
out << format (STRING_CMD_CONTEXT_SET_SUCC, value) << "\n";
|
||||
else
|
||||
{
|
||||
out << format (STRING_CMD_CONTEXT_SET_FAIL, value) << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Shows the currently active context.
|
||||
//
|
||||
// Returns: Always returns 0.
|
||||
//
|
||||
// Invoked with: task context show
|
||||
// Example: task context show
|
||||
//
|
||||
int CmdContext::showContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
std::string currentContext = context.config.get ("context");
|
||||
|
||||
if (currentContext == "")
|
||||
out << STRING_CMD_CONTEXT_SHOW_EMPT << "\n";
|
||||
else
|
||||
{
|
||||
std::string currentFilter = context.config.get ("context." + currentContext);
|
||||
out << format (STRING_CMD_CONTEXT_SHOW, currentContext, currentFilter) << "\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Unsets the currently active context.
|
||||
// - Unsetting of the context does not require confirmation.
|
||||
//
|
||||
// Returns: 0 if the unsetting of the context was successful, 1 otherwise (also
|
||||
// returned if no context is currently active)
|
||||
//
|
||||
// Invoked with: task context none
|
||||
// Example: task context none
|
||||
//
|
||||
int CmdContext::unsetContext (std::vector <std::string>& words, std::stringstream& out)
|
||||
{
|
||||
int rc = 0;
|
||||
int status = CmdConfig::unsetConfigVariable ("context", false);
|
||||
|
||||
if (status == 0)
|
||||
out << STRING_CMD_CONTEXT_NON_SUCC << "\n";
|
||||
else
|
||||
{
|
||||
out << STRING_CMD_CONTEXT_NON_FAIL << "\n";
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCompletionContext::CmdCompletionContext ()
|
||||
{
|
||||
_keyword = "_context";
|
||||
_usage = "task _context";
|
||||
_description = STRING_CMD_HCONTEXT_USAGE;
|
||||
_read_only = true;
|
||||
_displays_id = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int CmdCompletionContext::execute (std::string& output)
|
||||
{
|
||||
std::vector <std::string> userContexts = CmdContext::getContexts ();
|
||||
|
||||
std::vector <std::string>::iterator userContext;
|
||||
for (userContext = userContexts.begin (); userContext != userContexts.end (); ++userContext)
|
||||
output += *userContext + "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -24,40 +24,33 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <text.h>
|
||||
#include <test.h>
|
||||
#ifndef INCLUDED_CMDCONTEXT
|
||||
#define INCLUDED_CMDCONTEXT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
|
||||
class CmdContext : public Command
|
||||
{
|
||||
UnitTest t (16);
|
||||
public:
|
||||
CmdContext ();
|
||||
int execute (std::string&);
|
||||
std::string joinWords (std::vector <std::string>& words, unsigned int from, unsigned int to = 0);
|
||||
static std::vector <std::string> getContexts ();
|
||||
int defineContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int deleteContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int listContexts (std::vector <std::string>& words, std::stringstream& out);
|
||||
int setContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int showContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
int unsetContext (std::vector <std::string>& words, std::stringstream& out);
|
||||
};
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
unsetenv ("TASKRC");
|
||||
|
||||
t.is (mk_wcwidth ('a'), 1, "U+0061 --> 1");
|
||||
|
||||
t.is (mk_wcwidth (0x5149), 2, "U+5149 --> 2");
|
||||
t.is (mk_wcwidth (0x9a8c), 2, "U+9a8c --> 2");
|
||||
t.is (mk_wcwidth (0x4e70), 2, "U+4e70 --> 2");
|
||||
t.is (mk_wcwidth (0x94b1), 2, "U+94b1 --> 2");
|
||||
t.is (mk_wcwidth (0x5305), 2, "U+5305 --> 2");
|
||||
t.is (mk_wcwidth (0x91cd), 2, "U+91cd --> 2");
|
||||
t.is (mk_wcwidth (0x65b0), 2, "U+65b0 --> 2");
|
||||
t.is (mk_wcwidth (0x8bbe), 2, "U+8bbe --> 2");
|
||||
t.is (mk_wcwidth (0x8ba1), 2, "U+8ba1 --> 2");
|
||||
t.is (mk_wcwidth (0x5411), 2, "U+5411 --> 2");
|
||||
t.is (mk_wcwidth (0x4e0a), 2, "U+4e0a --> 2");
|
||||
t.is (mk_wcwidth (0x4e0b), 2, "U+4e0b --> 2");
|
||||
t.is (mk_wcwidth (0x7bad), 2, "U+7bad --> 2");
|
||||
t.is (mk_wcwidth (0x5934), 2, "U+5934 --> 2");
|
||||
t.is (mk_wcwidth (0xff0c), 2, "U+ff0c --> 2"); // comma
|
||||
|
||||
return 0;
|
||||
}
|
||||
class CmdCompletionContext : public Command
|
||||
{
|
||||
public:
|
||||
CmdCompletionContext ();
|
||||
int execute (std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -82,15 +82,7 @@ int CmdCustom::execute (std::string& output)
|
||||
validateSortColumns (sortOrder);
|
||||
|
||||
// Prepend the argument list with those from the report filter.
|
||||
std::string lexeme;
|
||||
Lexer::Type type;
|
||||
Lexer lex (reportFilter);
|
||||
lex.ambiguity (false);
|
||||
while (lex.token (lexeme, type))
|
||||
context.cli.add (lexeme);
|
||||
|
||||
// Reparse after tree change.
|
||||
context.cli.analyze ();
|
||||
context.cli.addRawFilter(reportFilter);
|
||||
|
||||
// Apply filter.
|
||||
handleRecurrence ();
|
||||
|
||||
@@ -312,7 +312,7 @@ int CmdDiagnostics::execute (std::string& output)
|
||||
out << bold.colorize (STRING_CMD_DIAG_HOOKS)
|
||||
<< "\n"
|
||||
<< " Scripts: "
|
||||
<< (context.config.getBoolean ("hooks") ? "Enabled" : "Disabled")
|
||||
<< (context.config.getBoolean ("hooks") ? STRING_CMD_DIAG_HOOK_ENABLE : STRING_CMD_DIAG_HOOK_DISABLE)
|
||||
<< "\n";
|
||||
|
||||
std::vector <std::string> hooks = context.hooks.list ();
|
||||
@@ -322,15 +322,20 @@ int CmdDiagnostics::execute (std::string& output)
|
||||
for (h = hooks.begin (); h != hooks.end (); ++h)
|
||||
{
|
||||
Path p (*h);
|
||||
std::string name = p.name ();
|
||||
out << " "
|
||||
<< *h
|
||||
<< (p.executable () ? " (executable)" : " (not executable)")
|
||||
<< (p.is_link () ? " (symlink)" : "")
|
||||
<< (p.executable () ? format (" ({1})", STRING_CMD_DIAG_HOOK_EXEC) : format (" ({1})", STRING_CMD_DIAG_HOOK_NO_EXEC))
|
||||
<< (p.is_link () ? format (" ({1})", STRING_CMD_DIAG_HOOK_SYMLINK) : "")
|
||||
<< ((name.substr (0, 6) == "on-add" ||
|
||||
name.substr (0, 9) == "on-modify" ||
|
||||
name.substr (0, 9) == "on-launch" ||
|
||||
name.substr (0, 7) == "on-exit") ? "" : format (" ({1})", STRING_CMD_DIAG_HOOK_NAME))
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
out << " (none)\n";
|
||||
out << format (" ({1})\n", STRING_CMD_DIAG_NONE);
|
||||
|
||||
out << "\n";
|
||||
|
||||
|
||||
@@ -48,10 +48,13 @@ int CmdExport::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
// Make sure reccurent tasks are generated.
|
||||
handleRecurrence ();
|
||||
|
||||
// Apply filter.
|
||||
Filter filter;
|
||||
std::vector <Task> filtered;
|
||||
filter.subset (filtered);
|
||||
filter.subset (filtered, false);
|
||||
|
||||
// Obey 'limit:N'.
|
||||
int rows = 0;
|
||||
|
||||
@@ -104,6 +104,9 @@ int CmdHistoryMonthly::execute (std::string& output)
|
||||
view.add (Column::factory ("string.right", STRING_CMD_HISTORY_DEL));
|
||||
view.add (Column::factory ("string.right", STRING_CMD_HISTORY_NET));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
int totalAdded = 0;
|
||||
int totalCompleted = 0;
|
||||
int totalDeleted = 0;
|
||||
@@ -257,6 +260,9 @@ int CmdHistoryAnnual::execute (std::string& output)
|
||||
view.add (Column::factory ("string.right", STRING_CMD_HISTORY_DEL));
|
||||
view.add (Column::factory ("string.right", STRING_CMD_HISTORY_NET));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
int totalAdded = 0;
|
||||
int totalCompleted = 0;
|
||||
int totalDeleted = 0;
|
||||
@@ -411,6 +417,9 @@ int CmdGHistoryMonthly::execute (std::string& output)
|
||||
Color color_add (context.config.get ("color.history.add"));
|
||||
Color color_done (context.config.get ("color.history.done"));
|
||||
Color color_delete (context.config.get ("color.history.delete"));
|
||||
Color label (context.config.get ("color.label"));
|
||||
|
||||
view.colorHeader (label);
|
||||
|
||||
// Determine the longest line, and the longest "added" line.
|
||||
int maxAddedLine = 0;
|
||||
@@ -603,6 +612,9 @@ int CmdGHistoryAnnual::execute (std::string& output)
|
||||
Color color_add (context.config.get ("color.history.add"));
|
||||
Color color_done (context.config.get ("color.history.done"));
|
||||
Color color_delete (context.config.get ("color.history.delete"));
|
||||
Color label (context.config.get ("color.label"));
|
||||
|
||||
view.colorHeader (label);
|
||||
|
||||
// Determine the longest line, and the longest "added" line.
|
||||
int maxAddedLine = 0;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <Filter.h>
|
||||
#include <Date.h>
|
||||
#include <Duration.h>
|
||||
#include <ViewText.h>
|
||||
#include <main.h>
|
||||
#include <text.h>
|
||||
#include <i18n.h>
|
||||
@@ -106,6 +105,9 @@ int CmdInfo::execute (std::string& output)
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
view.colorOdd (alternate);
|
||||
view.intraColorOdd (alternate);
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
}
|
||||
|
||||
Date now;
|
||||
@@ -312,6 +314,40 @@ int CmdInfo::execute (std::string& output)
|
||||
view.set (row, 1, allTags);
|
||||
}
|
||||
|
||||
// Virtual tags.
|
||||
{
|
||||
// Note: This list must match that in Task::hasTag.
|
||||
std::string virtualTags = "";
|
||||
if (task->hasTag ("ACTIVE")) virtualTags += "ACTIVE ";
|
||||
if (task->hasTag ("ANNOTATED")) virtualTags += "ANNOTATED ";
|
||||
if (task->hasTag ("BLOCKED")) virtualTags += "BLOCKED ";
|
||||
if (task->hasTag ("BLOCKING")) virtualTags += "BLOCKING ";
|
||||
if (task->hasTag ("CHILD")) virtualTags += "CHILD ";
|
||||
if (task->hasTag ("COMPLETED")) virtualTags += "COMPLETED ";
|
||||
if (task->hasTag ("DELETED")) virtualTags += "DELETED ";
|
||||
if (task->hasTag ("DUE")) virtualTags += "DUE ";
|
||||
if (task->hasTag ("DUETODAY")) virtualTags += "DUETODAY ";
|
||||
if (task->hasTag ("MONTH")) virtualTags += "MONTH ";
|
||||
if (task->hasTag ("OVERDUE")) virtualTags += "OVERDUE ";
|
||||
if (task->hasTag ("PARENT")) virtualTags += "PARENT ";
|
||||
if (task->hasTag ("PENDING")) virtualTags += "PENDING ";
|
||||
if (task->hasTag ("READY")) virtualTags += "READY ";
|
||||
if (task->hasTag ("SCHEDULED")) virtualTags += "SCHEDULED ";
|
||||
if (task->hasTag ("TAGGED")) virtualTags += "TAGGED ";
|
||||
if (task->hasTag ("TODAY")) virtualTags += "TODAY ";
|
||||
if (task->hasTag ("TOMORROW")) virtualTags += "TOMORROW ";
|
||||
if (task->hasTag ("UNBLOCKED")) virtualTags += "UNBLOCKED ";
|
||||
if (task->hasTag ("UNTIL")) virtualTags += "UNTIL ";
|
||||
if (task->hasTag ("WAITING")) virtualTags += "WAITING ";
|
||||
if (task->hasTag ("WEEK")) virtualTags += "WEEK ";
|
||||
if (task->hasTag ("YEAR")) virtualTags += "YEAR ";
|
||||
if (task->hasTag ("YESTERDAY")) virtualTags += "YESTERDAY ";
|
||||
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_CMD_INFO_VIRTUAL_TAGS);
|
||||
view.set (row, 1, virtualTags);
|
||||
}
|
||||
|
||||
// uuid
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_UUID);
|
||||
@@ -321,62 +357,7 @@ int CmdInfo::execute (std::string& output)
|
||||
// Task::urgency
|
||||
row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_URGENCY);
|
||||
|
||||
std::string urgency =
|
||||
trimLeft (format (task->urgency (), 4, 4)) + "\n" +
|
||||
urgencyTerm ("project", task->urgency_project (), Task::urgencyProjectCoefficient) +
|
||||
urgencyTerm ("priority", task->urgency_priority (), Task::urgencyPriorityCoefficient) +
|
||||
urgencyTerm ("active", task->urgency_active (), Task::urgencyActiveCoefficient) +
|
||||
urgencyTerm ("scheduled", task->urgency_scheduled (), Task::urgencyScheduledCoefficient) +
|
||||
urgencyTerm ("waiting", task->urgency_waiting (), Task::urgencyWaitingCoefficient) +
|
||||
urgencyTerm ("blocked", task->urgency_blocked (), Task::urgencyBlockedCoefficient) +
|
||||
urgencyTerm ("blocking", task->urgency_blocking (), Task::urgencyBlockingCoefficient) +
|
||||
urgencyTerm ("annotations", task->urgency_annotations (), Task::urgencyAnnotationsCoefficient) +
|
||||
urgencyTerm ("tags", task->urgency_tags (), Task::urgencyTagsCoefficient) +
|
||||
urgencyTerm ("next", task->urgency_next (), Task::urgencyNextCoefficient) +
|
||||
urgencyTerm ("due", task->urgency_due (), Task::urgencyDueCoefficient) +
|
||||
urgencyTerm ("age", task->urgency_age (), Task::urgencyAgeCoefficient);
|
||||
|
||||
// Tag, Project- and UDA-specific coefficients.
|
||||
std::map <std::string, float>::iterator var;
|
||||
for (var = Task::coefficients.begin (); var != Task::coefficients.end (); ++var)
|
||||
{
|
||||
if (var->first.substr (0, 13) == "urgency.user.")
|
||||
{
|
||||
// urgency.user.project.<project>.coefficient
|
||||
std::string::size_type end = std::string::npos;
|
||||
if (var->first.substr (13, 8) == "project." &&
|
||||
(end = var->first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
std::string project = var->first.substr (21, end - 21);
|
||||
if (task->get ("project").find (project) == 0)
|
||||
urgency += urgencyTerm ("PROJECT " + project, 1.0, var->second);
|
||||
}
|
||||
|
||||
// urgency.user.tag.<tag>.coefficient
|
||||
if (var->first.substr (13, 4) == "tag." &&
|
||||
(end = var->first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
std::string name = var->first.substr (17, end - 17);
|
||||
if (task->hasTag (name))
|
||||
urgency += urgencyTerm ("TAG " + name, 1.0, var->second);
|
||||
}
|
||||
}
|
||||
|
||||
// urgency.uda.<name>.coefficient
|
||||
else if (var->first.substr (0, 12) == "urgency.uda.")
|
||||
{
|
||||
std::string::size_type end = var->first.find (".coefficient");
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
std::string name = var->first.substr (12, end - 12);
|
||||
if (task->has (name))
|
||||
urgency += urgencyTerm ("UDA " + name, 1.0, var->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.set (row, 1, urgency);
|
||||
view.set (row, 1, format (task->urgency (), 4, 4));
|
||||
|
||||
// Show any UDAs
|
||||
std::vector <std::string> all = task->all ();
|
||||
@@ -410,6 +391,7 @@ int CmdInfo::execute (std::string& output)
|
||||
// Show any orphaned UDAs, which are identified by not being represented in
|
||||
// the context.columns map.
|
||||
for (att = all.begin (); att != all.end (); ++att)
|
||||
{
|
||||
if (att->substr (0, 11) != "annotation_" &&
|
||||
context.columns.find (*att) == context.columns.end ())
|
||||
{
|
||||
@@ -417,8 +399,86 @@ int CmdInfo::execute (std::string& output)
|
||||
view.set (row, 0, "[" + *att);
|
||||
view.set (row, 1, task->get (*att) + "]");
|
||||
}
|
||||
}
|
||||
|
||||
// Create a second table, containing undo log change details.
|
||||
// Create a second table, containing urgency details.
|
||||
ViewText urgencyDetails;
|
||||
if (context.color ())
|
||||
{
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
urgencyDetails.colorOdd (alternate);
|
||||
urgencyDetails.intraColorOdd (alternate);
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
urgencyDetails.colorHeader (label);
|
||||
}
|
||||
|
||||
urgencyDetails.width (context.getWidth ());
|
||||
urgencyDetails.add (Column::factory ("string", "")); // Attribute
|
||||
urgencyDetails.add (Column::factory ("string", "")); // Value
|
||||
urgencyDetails.add (Column::factory ("string", "")); // *
|
||||
urgencyDetails.add (Column::factory ("string", "")); // Coefficient
|
||||
urgencyDetails.add (Column::factory ("string", "")); // =
|
||||
urgencyDetails.add (Column::factory ("string", "")); // Result
|
||||
|
||||
urgencyTerm (urgencyDetails, "project", task->urgency_project (), Task::urgencyProjectCoefficient);
|
||||
urgencyTerm (urgencyDetails, "priority", task->urgency_priority (), Task::urgencyPriorityCoefficient);
|
||||
urgencyTerm (urgencyDetails, "active", task->urgency_active (), Task::urgencyActiveCoefficient);
|
||||
urgencyTerm (urgencyDetails, "scheduled", task->urgency_scheduled (), Task::urgencyScheduledCoefficient);
|
||||
urgencyTerm (urgencyDetails, "waiting", task->urgency_waiting (), Task::urgencyWaitingCoefficient);
|
||||
urgencyTerm (urgencyDetails, "blocked", task->urgency_blocked (), Task::urgencyBlockedCoefficient);
|
||||
urgencyTerm (urgencyDetails, "blocking", task->urgency_blocking (), Task::urgencyBlockingCoefficient);
|
||||
urgencyTerm (urgencyDetails, "annotations", task->urgency_annotations (), Task::urgencyAnnotationsCoefficient);
|
||||
urgencyTerm (urgencyDetails, "tags", task->urgency_tags (), Task::urgencyTagsCoefficient);
|
||||
urgencyTerm (urgencyDetails, "next", task->urgency_next (), Task::urgencyNextCoefficient);
|
||||
urgencyTerm (urgencyDetails, "due", task->urgency_due (), Task::urgencyDueCoefficient);
|
||||
urgencyTerm (urgencyDetails, "age", task->urgency_age (), Task::urgencyAgeCoefficient);
|
||||
|
||||
// Tag, Project- and UDA-specific coefficients.
|
||||
std::map <std::string, float>::iterator var;
|
||||
for (var = Task::coefficients.begin (); var != Task::coefficients.end (); ++var)
|
||||
{
|
||||
if (var->first.substr (0, 13) == "urgency.user.")
|
||||
{
|
||||
// urgency.user.project.<project>.coefficient
|
||||
std::string::size_type end = std::string::npos;
|
||||
if (var->first.substr (13, 8) == "project." &&
|
||||
(end = var->first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
std::string project = var->first.substr (21, end - 21);
|
||||
if (task->get ("project").find (project) == 0)
|
||||
urgencyTerm (urgencyDetails, "PROJECT " + project, 1.0, var->second);
|
||||
}
|
||||
|
||||
// urgency.user.tag.<tag>.coefficient
|
||||
if (var->first.substr (13, 4) == "tag." &&
|
||||
(end = var->first.find (".coefficient")) != std::string::npos)
|
||||
{
|
||||
std::string name = var->first.substr (17, end - 17);
|
||||
if (task->hasTag (name))
|
||||
urgencyTerm (urgencyDetails, "TAG " + name, 1.0, var->second);
|
||||
}
|
||||
}
|
||||
|
||||
// urgency.uda.<name>.coefficient
|
||||
else if (var->first.substr (0, 12) == "urgency.uda.")
|
||||
{
|
||||
std::string::size_type end = var->first.find (".coefficient");
|
||||
if (end != std::string::npos)
|
||||
{
|
||||
std::string name = var->first.substr (12, end - 12);
|
||||
if (task->has (name))
|
||||
urgencyTerm (urgencyDetails, "UDA " + name, 1.0, var->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row = urgencyDetails.addRow ();
|
||||
urgencyDetails.set (row, 5, rightJustify ("------", 6));
|
||||
row = urgencyDetails.addRow ();
|
||||
urgencyDetails.set (row, 5, rightJustify (format (task->urgency (), 4, 4), 6));
|
||||
|
||||
// Create a third table, containing undo log change details.
|
||||
ViewText journal;
|
||||
|
||||
// If an alternating row color is specified, notify the table.
|
||||
@@ -427,6 +487,9 @@ int CmdInfo::execute (std::string& output)
|
||||
Color alternate (context.config.get ("color.alternate"));
|
||||
journal.colorOdd (alternate);
|
||||
journal.intraColorOdd (alternate);
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
journal.colorHeader (label);
|
||||
}
|
||||
|
||||
journal.width (context.getWidth ());
|
||||
@@ -473,6 +536,10 @@ int CmdInfo::execute (std::string& output)
|
||||
<< view.render ()
|
||||
<< "\n";
|
||||
|
||||
if (urgencyDetails.rows () > 0)
|
||||
out << urgencyDetails.render ()
|
||||
<< "\n";
|
||||
|
||||
if (journal.rows () > 0)
|
||||
out << journal.render ()
|
||||
<< "\n";
|
||||
@@ -483,24 +550,23 @@ int CmdInfo::execute (std::string& output)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string CmdInfo::urgencyTerm (
|
||||
void CmdInfo::urgencyTerm (
|
||||
ViewText& view,
|
||||
const std::string& label,
|
||||
float measure,
|
||||
float coefficient) const
|
||||
{
|
||||
float value = measure * coefficient;
|
||||
if (fabsf (value) > epsilon)
|
||||
return std::string (
|
||||
rightJustify (label, 20) +
|
||||
" " +
|
||||
leftJustify (format (measure, 5, 3), 6) +
|
||||
" * " +
|
||||
leftJustify (format (coefficient, 4, 2), 4) +
|
||||
" = " +
|
||||
leftJustify (format (value, 5, 3), 5) +
|
||||
"\n");
|
||||
|
||||
return "";
|
||||
if (value != 0.0)
|
||||
{
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, " " + label);
|
||||
view.set (row, 1, rightJustify (format (measure, 5, 3), 6));
|
||||
view.set (row, 2, "+");
|
||||
view.set (row, 3, rightJustify (format (coefficient, 4, 2), 4));
|
||||
view.set (row, 4, "=");
|
||||
view.set (row, 5, rightJustify (format (value, 5, 3), 6));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <Command.h>
|
||||
#include <ViewText.h>
|
||||
|
||||
class CmdInfo : public Command
|
||||
{
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
int execute (std::string&);
|
||||
|
||||
private:
|
||||
std::string urgencyTerm (const std::string&, float, float) const;
|
||||
void urgencyTerm (ViewText&, const std::string&, float, float) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,6 +53,9 @@ int CmdProjects::execute (std::string& output)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
// Enforce the garbage collector to show correct task counts
|
||||
context.tdb2.gc ();
|
||||
|
||||
// Get all the tasks.
|
||||
handleRecurrence ();
|
||||
std::vector <Task> tasks = context.tdb2.pending.get_tasks ();
|
||||
@@ -89,8 +92,16 @@ int CmdProjects::execute (std::string& output)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Increase the count for the project the task belongs to and all
|
||||
// its super-projects
|
||||
project = task->get ("project");
|
||||
unique[project] += 1;
|
||||
|
||||
std::vector <std::string> projects = extractParents (project);
|
||||
projects.push_back (project);
|
||||
|
||||
std::vector <std::string>::const_iterator parent;
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
unique[*parent] += 1;
|
||||
|
||||
if (project == "")
|
||||
no_project = true;
|
||||
@@ -104,6 +115,9 @@ int CmdProjects::execute (std::string& output)
|
||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_PROJECT));
|
||||
view.add (Column::factory ("string.right", STRING_COLUMN_LABEL_TASKS));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
std::vector <std::string> processed;
|
||||
std::map <std::string, int>::iterator project;
|
||||
for (project = unique.begin (); project != unique.end (); ++project)
|
||||
|
||||
@@ -85,6 +85,9 @@ int CmdReports::execute (std::string& output)
|
||||
view.add (Column::factory ("string", STRING_CMD_REPORTS_REPORT));
|
||||
view.add (Column::factory ("string", STRING_CMD_REPORTS_DESC));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
// If an alternating row color is specified, notify the table.
|
||||
if (context.color ())
|
||||
{
|
||||
|
||||
@@ -127,6 +127,7 @@ int CmdShow::execute (std::string& output)
|
||||
" column.padding"
|
||||
" complete.all.tags"
|
||||
" confirmation"
|
||||
" context"
|
||||
" data.location"
|
||||
" dateformat"
|
||||
" dateformat.annotation"
|
||||
@@ -134,6 +135,7 @@ int CmdShow::execute (std::string& output)
|
||||
" dateformat.holiday"
|
||||
" dateformat.info"
|
||||
" dateformat.report"
|
||||
" date.iso"
|
||||
" debug"
|
||||
" debug.hooks"
|
||||
" debug.parser"
|
||||
@@ -171,6 +173,7 @@ int CmdShow::execute (std::string& output)
|
||||
" monthsperline"
|
||||
" nag"
|
||||
" print.empty.columns"
|
||||
" recurrence"
|
||||
" recurrence.confirmation"
|
||||
" recurrence.indicator"
|
||||
" recurrence.limit"
|
||||
@@ -228,6 +231,7 @@ int CmdShow::execute (std::string& output)
|
||||
i->first.substr (0, 14) != "color.project." &&
|
||||
i->first.substr (0, 10) != "color.tag." &&
|
||||
i->first.substr (0, 10) != "color.uda." &&
|
||||
i->first.substr (0, 8) != "context." &&
|
||||
i->first.substr (0, 8) != "holiday." &&
|
||||
i->first.substr (0, 7) != "report." &&
|
||||
i->first.substr (0, 6) != "alias." &&
|
||||
@@ -260,6 +264,9 @@ int CmdShow::execute (std::string& output)
|
||||
|
||||
Color error (context.config.get ("color.error"));
|
||||
Color warning (context.config.get ("color.warning"));
|
||||
Color label (context.config.get ("color.label"));
|
||||
|
||||
view.colorHeader (label);
|
||||
|
||||
bool issue_error = false;
|
||||
bool issue_warning = false;
|
||||
|
||||
@@ -160,6 +160,9 @@ int CmdStats::execute (std::string& output)
|
||||
view.add (Column::factory ("string", STRING_CMD_STATS_CATEGORY));
|
||||
view.add (Column::factory ("string", STRING_CMD_STATS_DATA));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
int row = view.addRow ();
|
||||
view.set (row, 0, STRING_COLUMN_LABEL_STAT_PE);
|
||||
view.set (row, 1, pendingT);
|
||||
|
||||
@@ -92,27 +92,34 @@ int CmdSummary::execute (std::string& output)
|
||||
for (task = filtered.begin (); task != filtered.end (); ++task)
|
||||
{
|
||||
std::string project = task->get ("project");
|
||||
++counter[project];
|
||||
std::vector <std::string> projects = extractParents (project);
|
||||
projects.push_back (project);
|
||||
|
||||
std::vector <std::string>::const_iterator parent;
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
++counter[*parent];
|
||||
|
||||
if (task->getStatus () == Task::pending ||
|
||||
task->getStatus () == Task::waiting)
|
||||
{
|
||||
++countPending[project];
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
{
|
||||
++countPending[*parent];
|
||||
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
if (entry)
|
||||
sumEntry[project] = sumEntry[project] + (double) (now - entry);
|
||||
}
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
if (entry)
|
||||
sumEntry[*parent] = sumEntry[*parent] + (double) (now - entry);
|
||||
}
|
||||
|
||||
else if (task->getStatus () == Task::completed)
|
||||
{
|
||||
++countCompleted[project];
|
||||
for (parent = projects.begin (); parent != projects.end (); ++parent)
|
||||
{
|
||||
++countCompleted[*parent];
|
||||
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
time_t end = strtol (task->get ("end").c_str (), NULL, 10);
|
||||
if (entry && end)
|
||||
sumEntry[project] = sumEntry[project] + (double) (end - entry);
|
||||
}
|
||||
time_t entry = strtol (task->get ("entry").c_str (), NULL, 10);
|
||||
time_t end = strtol (task->get ("end").c_str (), NULL, 10);
|
||||
if (entry && end)
|
||||
sumEntry[*parent] = sumEntry[*parent] + (double) (end - entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +134,7 @@ int CmdSummary::execute (std::string& output)
|
||||
|
||||
Color bar_color (context.config.get ("color.summary.bar"));
|
||||
Color bg_color (context.config.get ("color.summary.background"));
|
||||
Color label (context.config.get ("color.label"));
|
||||
Color label (context.config.get ("color.label"));
|
||||
|
||||
view.colorHeader (label);
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ int CmdTags::execute (std::string& output)
|
||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_TAG));
|
||||
view.add (Column::factory ("string.right", STRING_COLUMN_LABEL_COUNT));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
Color bold ("bold");
|
||||
bool special = false;
|
||||
std::map <std::string, int>::iterator i;
|
||||
|
||||
@@ -99,6 +99,9 @@ int CmdTimesheet::execute (std::string& output)
|
||||
completed.add (Column::factory ("string.right", STRING_COLUMN_LABEL_DUE));
|
||||
completed.add (Column::factory ("string", STRING_COLUMN_LABEL_DESC));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
completed.colorHeader (label);
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = all.begin (); task != all.end (); ++task)
|
||||
{
|
||||
@@ -155,6 +158,7 @@ int CmdTimesheet::execute (std::string& output)
|
||||
started.add (Column::factory ("string", STRING_COLUMN_LABEL_PROJECT));
|
||||
started.add (Column::factory ("string.right", STRING_COLUMN_LABEL_DUE));
|
||||
started.add (Column::factory ("string", STRING_COLUMN_LABEL_DESC));
|
||||
started.colorHeader (label);
|
||||
|
||||
for (task = all.begin (); task != all.end (); ++task)
|
||||
{
|
||||
|
||||
@@ -87,6 +87,9 @@ int CmdUDAs::execute (std::string& output)
|
||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_DEFAULT));
|
||||
view.add (Column::factory ("string", STRING_COLUMN_LABEL_UDACOUNT));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
view.colorHeader (label);
|
||||
|
||||
std::vector <std::string>::iterator uda;
|
||||
for (uda = udas.begin (); uda != udas.end (); ++uda)
|
||||
{
|
||||
@@ -147,6 +150,9 @@ int CmdUDAs::execute (std::string& output)
|
||||
orphanView.add (Column::factory ("string", STRING_COLUMN_LABEL_ORPHAN));
|
||||
orphanView.add (Column::factory ("string", STRING_COLUMN_LABEL_UDACOUNT));
|
||||
|
||||
Color label (context.config.get ("color.label"));
|
||||
orphanView.colorHeader (label);
|
||||
|
||||
std::map <std::string, int>::iterator o;
|
||||
for (o = orphans.begin (); o != orphans.end (); ++o)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,10 @@ CmdCompletionVersion::CmdCompletionVersion ()
|
||||
int CmdCompletionVersion::execute (std::string& output)
|
||||
{
|
||||
#ifdef HAVE_COMMIT
|
||||
output = COMMIT;
|
||||
output = std::string (VERSION)
|
||||
+ std::string (" (")
|
||||
+ std::string (COMMIT)
|
||||
+ std::string (")");
|
||||
#else
|
||||
output = VERSION;
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <CmdColumns.h>
|
||||
#include <CmdCommands.h>
|
||||
#include <CmdConfig.h>
|
||||
#include <CmdContext.h>
|
||||
#include <CmdCount.h>
|
||||
#include <CmdCustom.h>
|
||||
#include <CmdDelete.h>
|
||||
@@ -109,6 +110,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
||||
c = new CmdCompletionColumns (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionCommands (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionConfig (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionContext (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionIds (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionUDAs (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionUuids (); all[c->keyword ()] = c;
|
||||
@@ -116,6 +118,7 @@ void Command::factory (std::map <std::string, Command*>& all)
|
||||
c = new CmdCompletionTags (); all[c->keyword ()] = c;
|
||||
c = new CmdCompletionVersion (); all[c->keyword ()] = c;
|
||||
c = new CmdConfig (); all[c->keyword ()] = c;
|
||||
c = new CmdContext (); all[c->keyword ()] = c;
|
||||
c = new CmdCount (); all[c->keyword ()] = c;
|
||||
c = new CmdDelete (); all[c->keyword ()] = c;
|
||||
c = new CmdDenotate (); all[c->keyword ()] = c;
|
||||
@@ -163,29 +166,27 @@ void Command::factory (std::map <std::string, Command*>& all)
|
||||
|
||||
// Instantiate a command object for each custom report.
|
||||
std::vector <std::string> reports;
|
||||
Config::const_iterator i;
|
||||
for (i = context.config.begin (); i != context.config.end (); ++i)
|
||||
for (auto &i : context.config)
|
||||
{
|
||||
if (i->first.substr (0, 7) == "report.")
|
||||
if (i.first.substr (0, 7) == "report.")
|
||||
{
|
||||
std::string report = i->first.substr (7);
|
||||
std::string report = i.first.substr (7);
|
||||
std::string::size_type columns = report.find (".columns");
|
||||
if (columns != std::string::npos)
|
||||
reports.push_back (report.substr (0, columns));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector <std::string>::iterator report;
|
||||
for (report = reports.begin (); report != reports.end (); ++report)
|
||||
for (auto &report : reports)
|
||||
{
|
||||
// Make sure a custom report does not clash with a built-in command.
|
||||
if (all.find (*report) != all.end ())
|
||||
throw format (STRING_CMD_CONFLICT, *report);
|
||||
if (all.find (report) != all.end ())
|
||||
throw format (STRING_CMD_CONFLICT, report);
|
||||
|
||||
c = new CmdCustom (
|
||||
*report,
|
||||
"task <filter> " + *report,
|
||||
context.config.get ("report." + *report + ".description"));
|
||||
report,
|
||||
"task <filter> " + report,
|
||||
context.config.get ("report." + report + ".description"));
|
||||
|
||||
all[c->keyword ()] = c;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <cmake.h>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <Context.h>
|
||||
#include <main.h>
|
||||
@@ -53,7 +54,7 @@ int Context::getWidth ()
|
||||
terminal_height == 0)
|
||||
{
|
||||
unsigned short buff[4];
|
||||
if (ioctl (fileno(stdout), TIOCGWINSZ, &buff) != -1)
|
||||
if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &buff) != -1)
|
||||
{
|
||||
terminal_height = buff[0];
|
||||
terminal_width = buff[1];
|
||||
@@ -88,7 +89,7 @@ int Context::getHeight ()
|
||||
terminal_height == 0)
|
||||
{
|
||||
unsigned short buff[4];
|
||||
if (ioctl (fileno(stdout), TIOCGWINSZ, &buff) != -1)
|
||||
if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &buff) != -1)
|
||||
{
|
||||
terminal_height = buff[0];
|
||||
terminal_width = buff[1];
|
||||
|
||||
1032
src/l10n/deu-DEU.h
Normal file
1032
src/l10n/deu-DEU.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -296,6 +296,7 @@
|
||||
#define STRING_CMD_INFO_UNTIL "Until"
|
||||
#define STRING_CMD_INFO_MODIFICATION "Modification"
|
||||
#define STRING_CMD_INFO_MODIFIED "Last modified"
|
||||
#define STRING_CMD_INFO_VIRTUAL_TAGS "Virtual tags"
|
||||
#define STRING_CMD_UNDO_USAGE "Reverts the most recent change to a task"
|
||||
#define STRING_CMD_UNDO_MODS "The undo command does not allow further task modification."
|
||||
#define STRING_CMD_STATS_USAGE "Shows task database statistics"
|
||||
@@ -489,6 +490,8 @@
|
||||
#define STRING_CMD_SYNC_HANDSHAKE "Handshake failed. {1}"
|
||||
#define STRING_CMD_SYNC_TRUST_CA "You should either provide a CA certificate or override verification, but not both."
|
||||
#define STRING_CMD_SYNC_TRUST_OBS "The 'taskd.trust' settings may now only contain a value of 'strict', 'ignore hostname' or 'allow all'."
|
||||
|
||||
// STRING_CMD_DIAG_* strings all appear on the 'diag' command output.
|
||||
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
|
||||
#define STRING_CMD_DIAG_PLATFORM "Platform"
|
||||
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"
|
||||
@@ -510,6 +513,13 @@
|
||||
#define STRING_CMD_DIAG_UUID_NO_DUP "No duplicates found"
|
||||
#define STRING_CMD_DIAG_NONE "-none-"
|
||||
#define STRING_CMD_DIAG_HOOKS "Hooks"
|
||||
#define STRING_CMD_DIAG_HOOK_NAME "unrecognized hook name"
|
||||
#define STRING_CMD_DIAG_HOOK_SYMLINK "symlink"
|
||||
#define STRING_CMD_DIAG_HOOK_EXEC "executable"
|
||||
#define STRING_CMD_DIAG_HOOK_NO_EXEC "not executable"
|
||||
#define STRING_CMD_DIAG_HOOK_ENABLE "Enabled"
|
||||
#define STRING_CMD_DIAG_HOOK_DISABLE "Disabled"
|
||||
|
||||
#define STRING_CMD_HCOMMANDS_USAGE "Generates a list of all commands, for autocompletion purposes"
|
||||
#define STRING_CMD_ZSHCOMMANDS_USAGE "Generates a list of all commands, for zsh autocompletion purposes"
|
||||
#define STRING_CMD_ZSHATTS_USAGE "Generates a list of all attributes, for zsh autocompletion purposes"
|
||||
@@ -552,6 +562,25 @@
|
||||
#define STRING_CMD_CONFIG_NO_CHANGE "No changes made."
|
||||
#define STRING_CMD_CONFIG_NO_NAME "Specify the name of a config variable to modify."
|
||||
#define STRING_CMD_HCONFIG_USAGE "Lists all supported configuration variables, for completion purposes"
|
||||
#define STRING_CMD_CONTEXT_USAGE "Set and define contexts (default filters)"
|
||||
#define STRING_CMD_CONTEXT_DEF_SUCC "Context '{1}' defined."
|
||||
#define STRING_CMD_CONTEXT_DEF_FAIL "Context '{1}' not defined."
|
||||
#define STRING_CMD_CONTEXT_DEF_USAG "Both context name and its definition must be provided."
|
||||
#define STRING_CMD_CONTEXT_DEF_ABRT "Context definiton aborted."
|
||||
#define STRING_CMD_CONTEXT_DEF_ABRT2 "Filter validation failed: {1}"
|
||||
#define STRING_CMD_CONTEXT_DEF_CONF "The filter '{1}' matches 0 pending tasks. Do you wish to continue?"
|
||||
#define STRING_CMD_CONTEXT_DEL_SUCC "Context '{1}' deleted."
|
||||
#define STRING_CMD_CONTEXT_DEL_FAIL "Context '{1}' not deleted."
|
||||
#define STRING_CMD_CONTEXT_DEL_USAG "Context name needs to be specified."
|
||||
#define STRING_CMD_CONTEXT_LIST_EMPT "No contexts defined."
|
||||
#define STRING_CMD_CONTEXT_SET_NFOU "Context '{1}' not found."
|
||||
#define STRING_CMD_CONTEXT_SET_SUCC "Context '{1}' set. Use 'task context none' to remove."
|
||||
#define STRING_CMD_CONTEXT_SET_FAIL "Context '{1}' not applied."
|
||||
#define STRING_CMD_CONTEXT_SHOW_EMPT "No context is currently applied."
|
||||
#define STRING_CMD_CONTEXT_SHOW "Context '{1}' with filter '{2}' is currently applied."
|
||||
#define STRING_CMD_CONTEXT_NON_SUCC "Context unset."
|
||||
#define STRING_CMD_CONTEXT_NON_FAIL "Context not unset."
|
||||
#define STRING_CMD_HCONTEXT_USAGE "Lists all supported contexts, for completion purposes"
|
||||
#define STRING_CMD_CUSTOM_MISMATCH "There are different numbers of columns and labels for report '{1}'."
|
||||
#define STRING_CMD_CUSTOM_SHOWN "{1} shown"
|
||||
#define STRING_CMD_CUSTOM_COUNT "1 task"
|
||||
@@ -788,6 +817,18 @@
|
||||
#define STRING_HELPER_PROJECT_REM "({1} of {2} tasks remaining)."
|
||||
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
|
||||
|
||||
// Hooks
|
||||
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected."
|
||||
#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute."
|
||||
#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute."
|
||||
#define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}"
|
||||
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
|
||||
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: "
|
||||
#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}"
|
||||
#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}"
|
||||
#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}"
|
||||
#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script."
|
||||
|
||||
// JSON
|
||||
#define STRING_JSON_MISSING_VALUE "Error: missing value after ',' at position {1}"
|
||||
#define STRING_JSON_MISSING_VALUE2 "Error: missing value at position {1}"
|
||||
@@ -860,10 +901,6 @@
|
||||
#define STRING_TDB2_UNDO_SYNCED "Cannot undo change because the task was already synced. Modify the task instead."
|
||||
#define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}"
|
||||
|
||||
// utf8
|
||||
#define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation."
|
||||
#define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint."
|
||||
|
||||
// View
|
||||
#define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}."
|
||||
|
||||
@@ -970,7 +1007,7 @@
|
||||
|
||||
/*
|
||||
To be included later, before the 'precendence' line.
|
||||
|
||||
|
||||
" + - Addition, subtraction\n" \
|
||||
" ! Inversion\n" \
|
||||
" ~ !~ Match, no match\n" \
|
||||
@@ -990,4 +1027,3 @@
|
||||
#define STRING_UTIL_BYTES "B"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user