Commit graph

123 commits

Author SHA1 Message Date
Felix Schurk
93356b39c3 add initial bulk run from pre-commit over all files 2024-07-29 22:34:51 +02:00
Tomas Babej
4e00106c71 CLI2: Add method to get MISCELLANEOUS tokens 2021-09-18 14:15:47 -04:00
Tomas Babej
0bc92d6115
meta: Adjust copyright headers 2021-09-05 12:02:07 -04:00
Tomas Babej
c3f9d09d22 performance: Cache used command value
The detected command does not change once CLI2::analysis has been
performed. Cache the value of the command to avoid the need to
re-discover the correct value each time we're interested in it.
2021-04-24 10:47:28 -04:00
Tomas Babej
a19773873a performance: Cache CLI2::canonicalize lookups
Canonicalization of attributes or attribute prefixes happens once per
every single task considered in the filtering process. It maps short,
prefixed names to their full-length versions, for example:

"pro" -> "project" in the expression "project:Home"

It follows that such process is not task-dependant and as such the
lookups can be cached.
2021-04-24 10:47:28 -04:00
Tomas Babej
5716f5abb7 CLI2: Generalize method to add context to support writeable context 2021-04-03 15:01:39 -04:00
Tomas Babej
5c3cf0f438 CLI2: Implement inserting modification arguments
Method to inject mods into the command, to be used by writeable context.
2021-04-03 15:01:39 -04:00
Tomas Babej
9128798fee CLI2: Generalize 'add' to insert arguments at arbitrary position 2021-04-03 15:01:39 -04:00
Tomas Babej
a2c3d224d3 CLI2: Generalize _context_filter_added latch name 2021-04-03 15:01:39 -04:00
Tomas Babej
456dfdc8cf CLI2: Handle empty parentheses expressions
Since taskwarrior is a CLI tool, it is likely that it is interacted with
programmatically. As such, expressions that a human would not type, but
are syntactically correct are bound to occur. In particular, task
currently is not able to handle empty parentheses expressions:

    task +PENDING '(' ')'

This is due to "and" operator being injected between +PENDING (which
translates to '( status = pending )' and '('.

Modify the insertJunctions to not insert the 'and' operator between two
sub-expressions if one of them is an empty parentheses expression.

Closes #1896.
2021-01-30 21:40:41 -05:00
Tomas Babej
9017cd6e53
doc: Update copyright to 2021 2021-01-02 02:48:22 -05:00
Julien Rabinow
1aa77c9ede fix home_dir variable definition 2020-12-09 20:15:22 -05:00
Paul Beckingham
702af00435 Revert "[clang-tidy] Remove redundant const"
This reverts commit 55d103c491.
2020-12-05 16:18:37 -05:00
Rosen Penev
55d103c491 [clang-tidy] Remove redundant const
Found with readability-const-return-type

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-12-05 15:03:43 -05:00
Tomas Babej
a09f9d48ab Update copyright to 2020 2020-11-21 12:27:05 -05:00
taiyu
d2b1662a39 Simplify CLI2::get* methods. allow rc=... 2019-02-07 08:41:25 -05:00
Tomas Babej
8066e4e6e2 meta: Update copyright year 2019-01-01 08:46:21 -05:00
Simon Ruderich
e817dfc800 Always use https:// link for opensource.org
It was already used in a few places, make this consistent.
2018-03-04 14:53:07 +01:00
Paul Beckingham
0de169bb10 Copyright 2018 2017-12-31 19:22:07 -05:00
Paul Beckingham
a50e65a134 Copyright update 2017-01-01 12:30:04 -05:00
Paul Beckingham
ec4e6af00d CLI2: C++11 2016-02-03 21:44:28 -05:00
Paul Beckingham
641d232dea Copyright: Updated to 2016 2015-12-31 15:06:43 -05:00
Paul Beckingham
84b3055690 CLI2: Pseudo-args demoted to config settings
- When 'limit:N' is encountered, it is removed from the command line, and
  added as a config setting, equivalent to 'rc.limit:N'.
- This simplifieѕ subsequent command line parsing.
2015-09-12 09:03:15 -04:00
Paul Beckingham
c59afe34c4 TW-1656: Implicitly parenthesize argv filter
- Thanks to Daniel Shahaf.
2015-09-12 08:57:38 -04:00
Paul Beckingham
3b4dc9acb3 CLI2: Removed unused arg
- Thanks to Tomas Babej.
2015-09-07 12:44:41 -04:00
Paul Beckingham
3897c23c8d CLI2: Prevent loops
- Context was sometimes causing looping:

    ::analyze -> ::addContexFilter -> ::addFilter -> ::analyze

  This is prevented by a simple latch.
2015-09-06 01:42:30 -04:00
Paul Beckingham
a82927cb54 CLI2: Refactored some of ::prepareFilter into ::categorizeArgs 2015-09-04 17:14:50 -04:00
Paul Beckingham
6f294e2968 Debug: rc.sugar enables ID/UUID snytactic sugar
- This is not documented.  It is not for users.
2015-08-07 11:35:27 -04:00
Paul Beckingham
941e8c9f37 CLI2: When applying extra filters, insert at the beginning, thus avoiding '--' 2015-08-02 10:20:12 -04:00
Paul Beckingham
758df84539 Context: Now obeys command DNA
- Applying a context filter is now performed only when a command requests it.
2015-08-02 10:08:04 -04:00
Paul Beckingham
251eedf7e5 CLI2: Dead code removal 2015-07-17 15:35:11 -04:00
Paul Beckingham
a7eb32272c TW-1419: On add '-tag' is considered a tag removal, which makes no sense. 2015-07-13 14:24:24 -04:00
Paul Beckingham
a09a2bc241 CLI2: Added conditional expression eval
- Only non-'string' type attributes ('numeric', 'date', 'duration') support the
  evaluation of values in FILTER arguments, for example:
    due.before:now+1d
  If evaluation is supported, values need to be lexed into tokens, and if there
  are multiple tokens, parenthesize the set.
2015-07-13 01:09:11 -04:00
Paul Beckingham
694323a8f1 CLI2: Implemented ::lexFilterArgs
- Now spots filter elements that need to be Lexed.
2015-07-12 17:57:52 -04:00
Paul Beckingham
023fd9d38a CLI2: Removed obsolete ::decomposeModSubstitutions 2015-07-05 16:31:30 -04:00
Paul Beckingham
af71af1085 CLI2: Removed obsolete ::decomposeModTags 2015-07-05 16:30:59 -04:00
Paul Beckingham
f5ece63ec0 CLI2: Removed obsolete ::decomposeModAttributes 2015-07-05 16:29:54 -04:00
Paul Beckingham
460f2aeea5 CLI2: Refactoring
- Whenever A2::attribute sees 'raw' being set, it automaticall decomposes the
  arg, which can now be removed from other methods.
- New ::canonicalizeNames method means that the ::decomposeMod* methods are no
  longer needed.
- Removed ::findOverrides which now does nothing.
2015-07-05 16:13:56 -04:00
Paul Beckingham
0c568580b3 CLI2: Removed obsolete ::isUUIDList
- Removed unsupported UUID lists, which shoudl have been removed earlier when
  Lexer::Type::list was dropped.
- Reversed logic in 'if' statements to perform the lowest cost comparison first.
2015-07-05 10:39:34 -04:00
Paul Beckingham
bce24da6a5 CLI2: Eliminated unnecessary ::findTerminator 2015-07-01 21:47:19 -04:00
Paul Beckingham
1b83734392 CLI2: Added ::demoteDOM to demote unrecognized DOM args to words 2015-07-01 18:02:48 -04:00
Paul Beckingham
b67b2ccc96 CLI2: Added ::addContextFilter, and supporting processing 2015-06-27 15:53:24 -04:00
Paul Beckingham
82c5d019a3 CLI2: Added ::addFilter method 2015-06-22 10:30:29 -04:00
Paul Beckingham
30ad00fb7f CLI2: Removed unused default constructor A::A 2015-06-22 10:18:43 -04:00
Paul Beckingham
7432c0aead CLI2: Added ::getToken method for obtaining the canonical form, if possible 2015-06-22 00:35:35 -04:00
Paul Beckingham
54b2227729 CLI2: Removed unused ::decomposeModAttributeModifiers method 2015-06-21 23:47:05 -04:00
Paul Beckingham
82acbb28e3 CLI2: Added ::decomposeModAttributes 2015-06-21 23:43:02 -04:00
Paul Beckingham
c369f37509 CLI2: Removed unused A::unTagAll method 2015-06-21 23:06:06 -04:00
Paul Beckingham
77b97d658a CLI2: Added ::getLimit method 2015-06-21 21:19:19 -04:00
Paul Beckingham
867910f7de CLI2: Remove unused ::disqualifyOnlyParenOps method 2015-06-21 21:15:05 -04:00