Commit graph

6218 commits

Author SHA1 Message Date
Dustin J. Mitchell
53127bf844 add Context::withCurrentTask 2021-12-30 15:03:37 -05:00
Dustin J. Mitchell
2ea6dd627e Just set contextTask in Task::modify
Based on the observation that every command was setting contextTask
immediately before calling `task.modify(..)`.
2021-12-30 15:03:37 -05:00
Dustin J. Mitchell
db26a28bf9 move domSource to Eval, as it's an Eval source 2021-12-30 15:03:37 -05:00
Dustin J. Mitchell
6e9ad1048d move use of contextTask out of columns, into commands 2021-12-30 15:03:37 -05:00
Dustin J. Mitchell
4fa1c0bcfb remove temporary function 2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
e3dd91d45e use the existing (but misnamed) orphans method 2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
e768e2c100 compare Tasks directly, not their properties 2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
ac24ec1387 fixup and fix spelling for denotate 2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
9f149a7f35 use Task::getAnnotations to get annotatoins 2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
70f83b34ef Move diff formatting into Task (simple refactor)
The Task class already included two forms of diff. This adds another
two.
2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
8d3953183a Only set contextTask if not adding a new task
When adding a new task, the current task is empty, so there is no
context in which to evaluate DOM references.  #2683 will address this in
a more robust fashion.
2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
2812a8c77a Refactor getDOM to use a pointer for the optional context
It's possible to call getDOM without a contextual task.  Previously,
this was done by referencing a "dummy" task which necessitated a way to
distinguish such dummy tasks.  This switches to using a pointer and
treating the NULL value as meaning there is no context.

Note that this cannot use `std::optional<&Task>`, as optional does not
support reference types.
2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
3af5ceadc1 Return early from getDOM if there is no contextual task (refactor)
Before this change, all conditionals checked `have_ref`; returning early
is clearer.
2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
0d9e402d3e Add Task.is_empty, needed to identify "dummy" tasks (simple refactor)
getDOM takes an &Task that may be a reference to a dummy, or may be a
real task.  The is_empty method replaces `task.data.size() == 0` as a
way to distinguish the two.
2021-12-16 23:03:44 -05:00
Dustin J. Mitchell
dede40bc4e Replace direct Task.data access with a temp getter (syntactic refactor)
Now this getter, `data_removeme`, can easily be grepped out and
replaced, one usage at a time in small PRs.
2021-12-16 23:03:44 -05:00
Tomas Babej
3a00956144 ColDepends: Allow specifying short(er) UUIDs 2021-12-03 03:57:37 -05:00
Siôn le Roux
01add8a34a docs: Fix typo in XDG news
This had XFG written in it, it's surely a typo of XDG since on the next
line it's written correctly.
2021-11-23 21:05:01 +01:00
Tomas Babej
d54c7e090e Task: Correctly handle bulk removal of virtual tags/depends attributes
This edge case would happen if a user issued a following command

    $ task 1 mod depends:
or

    $ task 1 mod tags:

which would not perform as expected for tasks with non-empty depends /
tags attributes.

The problem under the hood is the fact that current synchronization
between 'tags" attribute and its constituent decomposed `tag_X`
attributes is performed in a way where the set of tags obtained from
`tag_X` attributes is taken as the source of truth.

If the legacy 'tags:' attribute was set to empty, the fixTags() method
would then restore its previous value from the `tag_X` attributes,
effectively leading to a no-op.

The same happens with dependencies. The fix here is to detect removal of
depends and tags attributes, and instead of setting the legacy
attributes to empty values, we iteratively remove all tags/dependencies.

Closes #2655.
2021-11-22 15:51:27 +01:00
Tomas Babej
0558b6c7aa ColDepends: Recognize and properly handle ID ranges 2021-11-20 15:19:34 -05:00
Tomas Babej
1e1c0e8f04 libshared: Bump to include fix for soww
See https://github.com/GothenburgBitFactory/libshared/pull/66 for
reference. Closes #2671.
2021-11-09 07:57:37 -05:00
Tomas Babej
493f36ecdd
CmdContext: Utilize new reason-providing validateWriteContext 2021-11-06 11:53:45 -04:00
Tomas Babej
5d8f8dac35
validateWriteContext: Refactor to return the underlying reason for invalidity directly 2021-11-06 11:53:44 -04:00
Tomas Babej
f5dce013ce
CmdContext: Expand the definition of an invalid write context to incllude tag exclusion 2021-11-06 11:53:44 -04:00
Tomas Babej
531881f651
validateWriteContext: Tag exclusion should also be detected as invalid write context 2021-11-06 11:53:43 -04:00
Tomas Babej
7de681aa3b
validateWriteContext: Apply early break when detected the OR operator 2021-11-06 11:53:42 -04:00
Jakub Wilk
04ef785eea Fix typo 2021-11-06 11:50:02 -04:00
Tomas Babej
72930708ec
CmdNews: Support Mac OS-X url opener 2021-11-04 22:07:39 -04:00
Tomas Babej
c99dab0dae
meta: Ensure Cygwin compatibility 2021-10-18 23:53:26 -04:00
Tomas Babej
2469943c98
meta: Bump libshared
This bumps libshared version to the one not suffering from
misidentification of certain ID ranges.

Closes #2639.
2021-10-18 23:15:03 -04:00
Tomas Babej
072b38d326
CmdCustom: Increase probability of displaying upgrade message
We have received reports from people that have upgraded, but seemingly
have not seen release notes in the `task news` command. One of the
causes here could be the fact that the probability of displaying the
footnote about running `task news` is `1/10`.

Increase the probability to 1/4.
2021-10-18 21:32:53 -04:00
Tomas Babej
dc81bf5fb5 CmdNews: Adjust for brevity 2021-10-18 21:31:41 -04:00
Tomas Babej
4287b33796 Task: Only consider pending tasks as waiting 2021-10-16 11:11:15 -04:00
Tomas Babej
793b23411a CmdUDAs: Do not identify tags and dependencies as orphan UDAs 2021-10-16 10:22:34 -04:00
Tomas Babej
fd549c764b Task: Do not identify tag and dependency attributes as orphans 2021-10-16 10:22:34 -04:00
Tomas Babej
339a4ddb51 Task: Make isTag/Dep/AnnotationAttr methods static
This allows usage of these helper methods outside of Task class.
2021-10-16 10:22:34 -04:00
Tomas Babej
d5a026d91a
context: Interpret legacy-style context as read context only
This provides a better migration path than surprising users with the
write context functionality out of the blue.

Closes #2620.
2021-10-14 22:34:48 -04:00
Tomas Babej
1d4baca0d9
context: Do not interpret empty filter/mods as missing context definition
This is a corner case bug, when user has both old-style and new-style
context defined, where new-style is defined as empty string, the
old-style will (incorrectly) take precedence.

Closes #2629.
2021-10-14 17:47:11 -04:00
Tomas Babej
dbf641988e
CmdTags: Update pointers to task enumeration lists 2021-10-02 21:38:47 -04:00
Tomas Janousek
8610268cd9
Add missing "QUARTER" to feedback_reserved_tags
A while ago I noticed that 630a1530e0 only
added the QUARTER virtual tag to src/Task.cpp, and when I checked that
again today, it was still missing from src/feedback.cpp, so I'm fixing
that.
2021-10-02 21:33:16 -04:00
Leo
57680f5bde
Uncoditionally include errno.h instead of guessing
POSIX tells us that it is errno.h, musl fails to build with -Werror
because it redirects sys/errno.h->errno.h and uses #warning

(cherry picked from commit 041248e7cc)
2021-10-02 21:30:40 -04:00
Tomas Babej
34c12a7b78
Context: Add news.version among configuration defaults
Otherwise news.version shows up as unrecognized variable.
2021-10-02 18:27:57 -04:00
Tomas Babej
a392983631
CmdNews: Minor adjustments 2021-10-02 17:10:59 -04:00
Tomas Babej
ef53c4fc75
CmdCustom: Generate notice about task news 2021-10-02 16:58:16 -04:00
Tomas Babej
5ccfece56d
CmdNews: Improve footnote advertising of minor higlights 2021-10-02 16:25:27 -04:00
Tomas Babej
5e5a68e045
CmdNews: Mark more higlights as major 2021-10-02 16:24:57 -04:00
Tomas Babej
214890af26
CmdNews: Prevent double outro by reverting to defautl signal handler 2021-10-02 16:08:11 -04:00
Tomas Babej
bd39e6b2e0
CmdNews: Prevent compiler warning 2021-10-02 16:08:10 -04:00
Tomas Babej
cb4444098e
CmdNews: Add short outro on interrupt 2021-10-02 16:08:09 -04:00
Tomas Babej
7e3ea4f47e
CmdNews: Implement short outro section 2021-10-02 16:08:08 -04:00
Tomas Babej
8ef6aa4bce
CmdNews: Guide users about minor highlights 2021-10-02 13:11:31 -04:00