mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Apply 'one sentence, one line'
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
a30a2a1a8b
commit
0d56d1c790
1 changed files with 32 additions and 53 deletions
|
@ -1,31 +1,26 @@
|
||||||
Rules System
|
Rules System
|
||||||
============
|
============
|
||||||
The Timewarrior rule system reads your timewarrior.cfg file and
|
The Timewarrior rule system reads your timewarrior.cfg file and uses the combination of configuration settings and logic within to:
|
||||||
uses the combination of configuration settings and logic within to:
|
|
||||||
|
|
||||||
- Define configuration and customization details
|
- Define configuration and customization details
|
||||||
- Define tags, exclusions, constraints
|
- Define tags, exclusions, constraints
|
||||||
- Define various policies
|
- Define various policies
|
||||||
|
|
||||||
On non-Unix systems config file is expected in ~/.timewarrior directory.
|
On non-Unix systems config file is expected in ~/.timewarrior directory.
|
||||||
On Unix systems, if legacy ~/.timewarrior directory doesn't exist, config is
|
On Unix systems, if legacy ~/.timewarrior directory doesn't exist, config is read from $XDG_CONFIG_HOME/timewarrior directory (if not specified, $XDG_CONFIG_HOME defaults to ~/.config).
|
||||||
read from $XDG_CONFIG_HOME/timewarrior directory (if not specified,
|
|
||||||
$XDG_CONFIG_HOME defaults to ~/.config).
|
|
||||||
|
|
||||||
The rules are a mechanism to apply late-bound logic and data to various
|
The rules are a mechanism to apply late-bound logic and data to various functions.
|
||||||
functions. Whenever data changes, the rule system is run, which will run each
|
Whenever data changes, the rule system is run, which will run each
|
||||||
rule in turn, if it applies, going from top to bottom in the rules file. There
|
rule in turn, if it applies, going from top to bottom in the rules file.
|
||||||
are no chained rules, but errors will be able to terminate rule processing and
|
There are no chained rules, but errors will be able to terminate rule processing and program execution.
|
||||||
program execution.
|
|
||||||
|
|
||||||
As much functionality as possible is to be deferred to the rules system, which
|
As much functionality as possible is to be deferred to the rules system, which will initially be minimal, but grow to become more capable.
|
||||||
will initially be minimal, but grow to become more capable.
|
|
||||||
|
|
||||||
|
|
||||||
Format
|
Format
|
||||||
------
|
------
|
||||||
The rules are written as UTF8 text in the timewarrior.cfg text file. Other
|
The rules are written as UTF8 text in the timewarrior.cfg text file.
|
||||||
rules files may be included:
|
Other rules files may be included:
|
||||||
|
|
||||||
import /path/to/other/rule/file
|
import /path/to/other/rule/file
|
||||||
|
|
||||||
|
@ -34,8 +29,7 @@ The syntax of rules is Python-like, in that indentation is significant.
|
||||||
|
|
||||||
Types of Rules
|
Types of Rules
|
||||||
--------------
|
--------------
|
||||||
There are several different types of rules, for example there is the rule that
|
There are several different types of rules, for example there is the rule that defines all exclusions:
|
||||||
defines all exclusions:
|
|
||||||
|
|
||||||
define exclusions:
|
define exclusions:
|
||||||
...
|
...
|
||||||
|
@ -60,8 +54,7 @@ There are rules that will serve as hooks:
|
||||||
|
|
||||||
Rule Type: Exclusions
|
Rule Type: Exclusions
|
||||||
---------------------
|
---------------------
|
||||||
Because exclusions are resolved at run time, and only when needed, they should
|
Because exclusions are resolved at run time, and only when needed, they should be stored in a readily-interpreted form:
|
||||||
be stored in a readily-interpreted form:
|
|
||||||
|
|
||||||
define exclusions:
|
define exclusions:
|
||||||
monday = <8:00:00 12:00:00-12:45:00 >17:30:00
|
monday = <8:00:00 12:00:00-12:45:00 >17:30:00
|
||||||
|
@ -74,17 +67,15 @@ be stored in a readily-interpreted form:
|
||||||
2016_01_01 = Working
|
2016_01_01 = Working
|
||||||
2016_01_02 = Off
|
2016_01_02 = Off
|
||||||
|
|
||||||
If you want to track your lunch breaks, then you would make a tag for it, and
|
If you want to track your lunch breaks, then you would make a tag for it, and track it like any other project.
|
||||||
track it like any other project. If you do not want to track that time, add an
|
If you do not want to track that time, add an exclusion for it.
|
||||||
exclusion for it.
|
|
||||||
|
|
||||||
|
|
||||||
Rule Type: General
|
Rule Type: General
|
||||||
------------------
|
------------------
|
||||||
There are rules triggered by changes to the data. In this example, rule 'one'
|
There are rules triggered by changes to the data.
|
||||||
is a constraint that prevents the value 'foo' from exceeding three. It is
|
In this example, rule 'one' is a constraint that prevents the value 'foo' from exceeding three.
|
||||||
triggered by a change to 'foo', which is a DOM reference, and can prevent the
|
It is triggered by a change to 'foo', which is a DOM reference, and can prevent the update by failing:
|
||||||
update by failing:
|
|
||||||
|
|
||||||
define rules:
|
define rules:
|
||||||
one:
|
one:
|
||||||
|
@ -97,8 +88,7 @@ Note that this rule is defined as applying to the tagset 'tag1'.
|
||||||
|
|
||||||
Rule Type: Tag
|
Rule Type: Tag
|
||||||
--------------
|
--------------
|
||||||
A defined tag is a way to associate metadata with a tag, such as a description
|
A defined tag is a way to associate metadata with a tag, such as a description and start/end dates for use:
|
||||||
and start/end dates for use:
|
|
||||||
|
|
||||||
define tags:
|
define tags:
|
||||||
"tag1":
|
"tag1":
|
||||||
|
@ -112,8 +102,7 @@ and start/end dates for use:
|
||||||
|
|
||||||
Rule Type: Theme
|
Rule Type: Theme
|
||||||
----------------
|
----------------
|
||||||
A color theme is defined by a rule, and consists of color definitions for
|
A color theme is defined by a rule, and consists of color definitions for various report and feedback elements:
|
||||||
various report and feedback elements:
|
|
||||||
|
|
||||||
define theme:
|
define theme:
|
||||||
description = "A monochrome, 256-color theme"
|
description = "A monochrome, 256-color theme"
|
||||||
|
@ -125,20 +114,16 @@ various report and feedback elements:
|
||||||
color2 = "white on blue"
|
color2 = "white on blue"
|
||||||
...
|
...
|
||||||
|
|
||||||
The palette group is a list (more is better) of themed colors for use when auto-
|
The palette group is a list (more is better) of themed colors for use when auto-coloring tags.
|
||||||
coloring tags.
|
|
||||||
|
|
||||||
There is only one theme namespace, so if multiple themes are imported, the last
|
There is only one theme namespace, so if multiple themes are imported, the last one can override all the prior theme settings.
|
||||||
one can override all the prior theme settings. This means themes can be layered,
|
This means themes can be layered, but they would need to be designed for this.
|
||||||
but they would need to be designed for this.
|
|
||||||
|
|
||||||
|
|
||||||
Rule Type: Hook
|
Rule Type: Hook
|
||||||
---------------
|
---------------
|
||||||
While there may not be hooks in the traditional sense, with fixed arguments,
|
While there may not be hooks in the traditional sense, with fixed arguments, there will be rules that have the same role.
|
||||||
there will be rules that have the same role. Hook rules will allow an internal
|
Hook rules will allow an internal event to trigger a rule that calls an external script, and passes an arbitrary set of arguments.
|
||||||
event to trigger a rule that calls an external script, and passes an arbitrary
|
|
||||||
set of arguments.
|
|
||||||
|
|
||||||
[Mechanism TBD]
|
[Mechanism TBD]
|
||||||
|
|
||||||
|
@ -154,8 +139,7 @@ set of arguments.
|
||||||
on_modify:
|
on_modify:
|
||||||
...
|
...
|
||||||
|
|
||||||
These rules can run an external script and provide arguments, based on rules
|
These rules can run an external script and provide arguments, based on rules DOM access:
|
||||||
DOM access:
|
|
||||||
|
|
||||||
define rules:
|
define rules:
|
||||||
on_modify:
|
on_modify:
|
||||||
|
@ -164,8 +148,7 @@ DOM access:
|
||||||
|
|
||||||
Rules Type: Hint
|
Rules Type: Hint
|
||||||
----------------
|
----------------
|
||||||
Hints may be defined using the rules system, to augment the built-in hints that
|
Hints may be defined using the rules system, to augment the built-in hints that are used by almost every command.
|
||||||
are used by almost every command.
|
|
||||||
|
|
||||||
define hints:
|
define hints:
|
||||||
staff:
|
staff:
|
||||||
|
@ -177,8 +160,7 @@ are used by almost every command.
|
||||||
|
|
||||||
--- Raw Notes ---
|
--- Raw Notes ---
|
||||||
|
|
||||||
- Need to distinguish between regular time and over time, with different rates
|
- Need to distinguish between regular time and over time, with different rates and limits.
|
||||||
and limits.
|
|
||||||
|
|
||||||
- Policy support involves things like:
|
- Policy support involves things like:
|
||||||
- warn after 40 hrs/wk
|
- warn after 40 hrs/wk
|
||||||
|
@ -186,8 +168,7 @@ are used by almost every command.
|
||||||
- auto-tag intervals that exceed 40 hrs/wk
|
- auto-tag intervals that exceed 40 hrs/wk
|
||||||
- auto-tag intervals during exclusion time
|
- auto-tag intervals during exclusion time
|
||||||
|
|
||||||
- Need to distinguish between rules that will be supported at 1.0.0, and the
|
- Need to distinguish between rules that will be supported at 1.0.0, and the long term enhancements.
|
||||||
long term enhancements.
|
|
||||||
|
|
||||||
- There will need to be several built-in functions, for use by rules:
|
- There will need to be several built-in functions, for use by rules:
|
||||||
|
|
||||||
|
@ -198,12 +179,10 @@ are used by almost every command.
|
||||||
|
|
||||||
These are not good examples.
|
These are not good examples.
|
||||||
|
|
||||||
- Need reports to help users doing fixed-rate work - finding the longest task
|
- Need reports to help users doing fixed-rate work - finding the longest task for example.
|
||||||
for example.
|
|
||||||
|
|
||||||
- If an interval has more than one tag with a defined color, and is being
|
- If an interval has more than one tag with a defined color, and is being rendered, then use the first tag color.
|
||||||
rendered, then use the first tag color. It doesn't really matter which.
|
It doesn't really matter which.
|
||||||
|
|
||||||
- Use display granularity/resolution to see more or less details. This would
|
|
||||||
combine nicely with a tag hierarchy. (Tomas Babej)
|
|
||||||
|
|
||||||
|
- Use display granularity/resolution to see more or less details.
|
||||||
|
This would combine nicely with a tag hierarchy. (Tomas Babej)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue