mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
parent
067a475614
commit
c598f2bd66
42 changed files with 2522 additions and 2 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**/man/**]
|
||||||
|
insert_final_newline = false
|
1
AUTHORS
1
AUTHORS
|
@ -71,3 +71,4 @@ Thanks to the following, who submitted detailed bug reports and excellent sugges
|
||||||
sclo
|
sclo
|
||||||
ddombrowsky
|
ddombrowsky
|
||||||
triclops200
|
triclops200
|
||||||
|
Valodim
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
(thanks to janikrabe)
|
(thanks to janikrabe)
|
||||||
- #174 Interval is split in two when it encloses month border
|
- #174 Interval is split in two when it encloses month border
|
||||||
- #183 Hyphen in annotation gets padded with spaces
|
- #183 Hyphen in annotation gets padded with spaces
|
||||||
|
- #189 segfault on timew get dom.active.tag.0
|
||||||
|
(thanks to Valodim)
|
||||||
- Fixed error from totals.py while timer is active
|
- Fixed error from totals.py while timer is active
|
||||||
(thanks to davisdude)
|
(thanks to davisdude)
|
||||||
- Refactoring of Interval and Range
|
- Refactoring of Interval and Range
|
||||||
|
|
88
README-Template.md
Normal file
88
README-Template.md
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# Project Title
|
||||||
|
|
||||||
|
One Paragraph of project description goes here
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
What things you need to install the software and how to install them
|
||||||
|
|
||||||
|
```
|
||||||
|
Give examples
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installing
|
||||||
|
|
||||||
|
A step by step series of examples that tell you have to get a development env running
|
||||||
|
|
||||||
|
Say what the step will be
|
||||||
|
|
||||||
|
```
|
||||||
|
Give the example
|
||||||
|
```
|
||||||
|
|
||||||
|
And repeat
|
||||||
|
|
||||||
|
```
|
||||||
|
until finished
|
||||||
|
```
|
||||||
|
|
||||||
|
End with an example of getting some data out of the system or using it for a little demo
|
||||||
|
|
||||||
|
## Running the tests
|
||||||
|
|
||||||
|
Explain how to run the automated tests for this system
|
||||||
|
|
||||||
|
### Break down into end to end tests
|
||||||
|
|
||||||
|
Explain what these tests test and why
|
||||||
|
|
||||||
|
```
|
||||||
|
Give an example
|
||||||
|
```
|
||||||
|
|
||||||
|
### And coding style tests
|
||||||
|
|
||||||
|
Explain what these tests test and why
|
||||||
|
|
||||||
|
```
|
||||||
|
Give an example
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
Add additional notes about how to deploy this on a live system
|
||||||
|
|
||||||
|
## Built With
|
||||||
|
|
||||||
|
* [Dropwizard](http://www.dropwizard.io/1.0.2/docs/) - The web framework used
|
||||||
|
* [Maven](https://maven.apache.org/) - Dependency Management
|
||||||
|
* [ROME](https://rometools.github.io/rome/) - Used to generate RSS Feeds
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
* **Billie Thompson** - *Initial work* - [PurpleBooth](https://github.com/PurpleBooth)
|
||||||
|
|
||||||
|
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
* Hat tip to anyone who's code was used
|
||||||
|
* Inspiration
|
||||||
|
* etc
|
||||||
|
|
57
TI-103-1.sh
Executable file
57
TI-103-1.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
cat <<EOF > ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
exclusions.monday = <9:00 >20:00
|
||||||
|
exclusions.tuesday = <9:00 >20:00
|
||||||
|
exclusions.wednesday = <9:00 >20:00
|
||||||
|
exclusions.thursday = <9:00 >20:00
|
||||||
|
exclusions.friday = <9:00 >20:00
|
||||||
|
exclusions.saturday = <9:00 >20:00
|
||||||
|
exclusions.sunday = <9:00 >20:00
|
||||||
|
reports.day.hours = auto
|
||||||
|
reports.week.hours = auto
|
||||||
|
reports.month.hours = auto
|
||||||
|
EOF
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track "${YESTERDAY}T1200" - "${YESTERDAY}T1400" FOO
|
||||||
|
src/timew start "${YESTERDAY}T1900" BAR
|
||||||
|
#src/timew week :month
|
||||||
|
|
||||||
|
echo "TI-103-1.sh: open interval from yesterday"
|
58
TI-103-2.sh
Executable file
58
TI-103-2.sh
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
cat <<EOF > ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
exclusions.monday = <9:00 >20:00
|
||||||
|
exclusions.tuesday = <9:00 >20:00
|
||||||
|
exclusions.wednesday = <9:00 >20:00
|
||||||
|
exclusions.thursday = <9:00 >20:00
|
||||||
|
exclusions.friday = <9:00 >20:00
|
||||||
|
exclusions.saturday = <9:00 >20:00
|
||||||
|
exclusions.sunday = <9:00 >20:00
|
||||||
|
reports.day.hours = auto
|
||||||
|
reports.week.hours = auto
|
||||||
|
reports.month.hours = auto
|
||||||
|
EOF
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track "${YESTERDAY}T1200" - "${YESTERDAY}T1400" FOO
|
||||||
|
src/timew track "${YESTERDAY}T1900" - "${YESTERDAY}T2000" BAR1
|
||||||
|
src/timew start "${TODAY}T0900" BAR2
|
||||||
|
#src/timew week :month
|
||||||
|
|
||||||
|
echo "TI-103-2.sh: open interval today"
|
56
TI-103-3.sh
Executable file
56
TI-103-3.sh
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
cat <<EOF > ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
exclusions.monday = <9:00 >20:00
|
||||||
|
exclusions.tuesday = <9:00 >20:00
|
||||||
|
exclusions.wednesday = <9:00 >20:00
|
||||||
|
exclusions.thursday = <9:00 >20:00
|
||||||
|
exclusions.friday = <9:00 >20:00
|
||||||
|
exclusions.saturday = <9:00 >20:00
|
||||||
|
exclusions.sunday = <9:00 >20:00
|
||||||
|
reports.day.hours = auto
|
||||||
|
reports.week.hours = auto
|
||||||
|
reports.month.hours = auto
|
||||||
|
EOF
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track "${YESTERDAY}T1200" - "${YESTERDAY}T1400" FOO
|
||||||
|
#src/timew week :month
|
||||||
|
|
||||||
|
echo "TI-103.sh: no open interval"
|
58
TI-103-4.sh
Executable file
58
TI-103-4.sh
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
cat <<EOF > ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
exclusions.monday = <9:00 >20:00
|
||||||
|
exclusions.tuesday = <9:00 >20:00
|
||||||
|
exclusions.wednesday = <9:00 >20:00
|
||||||
|
exclusions.thursday = <9:00 >20:00
|
||||||
|
exclusions.friday = <9:00 >20:00
|
||||||
|
exclusions.saturday = <9:00 >20:00
|
||||||
|
exclusions.sunday = <9:00 >20:00
|
||||||
|
reports.day.hours = auto
|
||||||
|
reports.week.hours = auto
|
||||||
|
reports.month.hours = auto
|
||||||
|
EOF
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track "${YESTERDAY}T1200" - "${YESTERDAY}T1400" FOO
|
||||||
|
src/timew track "${YESTERDAY}T1900" - "${YESTERDAY}T2000" BAR1
|
||||||
|
src/timew track "${TODAY}T0900" - "${TODAY}T1200" BAR2
|
||||||
|
#src/timew week :month
|
||||||
|
|
||||||
|
echo "TI-103-4.sh: closed interval today"
|
51
TI-103-5.sh
Executable file
51
TI-103-5.sh
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
cat <<EOF > ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
reports.day.hours = auto
|
||||||
|
reports.week.hours = auto
|
||||||
|
reports.month.hours = auto
|
||||||
|
EOF
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track "${YESTERDAY}T1200" - "${YESTERDAY}T1400" FOO
|
||||||
|
src/timew track "${YESTERDAY}T1900" - "${YESTERDAY}T2000" BAR1
|
||||||
|
src/timew start "${TODAY}T0900" BAR2
|
||||||
|
#src/timew week :month
|
||||||
|
|
||||||
|
echo "TI-103-4.sh: open interval today (no exclusions)"
|
13
TI-11.sh
Executable file
13
TI-11.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
timew start ${YESTERDAY}T124452Z homework
|
||||||
|
timew month
|
||||||
|
timew week
|
||||||
|
timew day
|
||||||
|
|
39
TI-155.sh
Executable file
39
TI-155.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/mnt/smalldisk/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
42
TI-159-double-quoted-2.sh
Executable file
42
TI-159-double-quoted-2.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew start 5min ago "Numbers 1 2 3 Somewhere" "\"one-quoted-word\""
|
||||||
|
src/timew stop
|
||||||
|
|
42
TI-159-double-quoted.sh
Executable file
42
TI-159-double-quoted.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew start 5min ago "Numbers 1 2 3 Somewhere" "'one-quoted-word'"
|
||||||
|
src/timew stop
|
||||||
|
|
42
TI-159-single-quoted-2.sh
Executable file
42
TI-159-single-quoted-2.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew start 5min ago 'foo' '\"quoted words\"'
|
||||||
|
#src/timew stop :debug
|
||||||
|
|
42
TI-159-single-quoted.sh
Executable file
42
TI-159-single-quoted.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew start 5min ago 'Numbers 1 2 3 Somewhere' '"one-quoted-word"'
|
||||||
|
src/timew stop
|
||||||
|
|
46
TI-170.sh
Executable file
46
TI-170.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track ${two_hours_before} - ${two_hours_before}
|
||||||
|
src/timew track ${one_hour_before} - ${one_hour_before}
|
||||||
|
src/timew summary :year :ids
|
||||||
|
|
||||||
|
src/timew move @2 ${three_hours_before}
|
||||||
|
#src/timew move @2 2018-08-01
|
||||||
|
|
47
TI-189.sh
Executable file
47
TI-189.sh
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/tmp/timewarriordb
|
||||||
|
mkdir -p ${TIMEWARRIORDB}
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew get dom.active.tag.0
|
||||||
|
|
||||||
|
src/timew start FOO
|
||||||
|
|
||||||
|
src/timew get dom.active.tag.0
|
||||||
|
src/timew get dom.active.tag.1
|
||||||
|
|
42
TI-57.sh
Executable file
42
TI-57.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track ${one_hour_before} - ${one_hour_after} AHEAD
|
||||||
|
src/timew track ${one_hour_after} - ${two_hours_after} FUTURE
|
||||||
|
|
41
TI-62.sh
Executable file
41
TI-62.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/home/lauft/Projects/timew/timewarriordb
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
||||||
|
src/timew track ${one_hour_before} - ${one_hour_after}
|
||||||
|
|
40
TI-XX.sh
Executable file
40
TI-XX.sh
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TODAY=$(date "+%Y%m%d")
|
||||||
|
YESTERDAY=$(date -d "yesterday" "+%Y%m%d")
|
||||||
|
CURRENT_HOUR=$(date +%k)
|
||||||
|
|
||||||
|
function get_current_date_with_delta()
|
||||||
|
{
|
||||||
|
local delta=${1}
|
||||||
|
|
||||||
|
let "hour = CURRENT_HOUR + delta"
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 0 ]] ; then
|
||||||
|
let "hour = hour + 24"
|
||||||
|
day=${YESTERDAY}
|
||||||
|
else
|
||||||
|
day=${TODAY}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${hour} -lt 10 ]] ; then
|
||||||
|
hour="0${hour}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${day}T${hour}0000"
|
||||||
|
}
|
||||||
|
|
||||||
|
export TIMEWARRIORDB=/tmp/timewarriordb
|
||||||
|
mkdir -p ${TIMEWARRIORDB}
|
||||||
|
rm -f ${TIMEWARRIORDB}/data/*.data
|
||||||
|
:> ${TIMEWARRIORDB}/timewarrior.cfg
|
||||||
|
|
||||||
|
five_hours_before=$(get_current_date_with_delta "-5")
|
||||||
|
four_hours_before=$(get_current_date_with_delta "-4")
|
||||||
|
three_hours_before=$(get_current_date_with_delta "-3")
|
||||||
|
two_hours_before=$(get_current_date_with_delta "-2")
|
||||||
|
one_hour_before=$(get_current_date_with_delta "-1")
|
||||||
|
current_hour=$(get_current_date_with_delta "0")
|
||||||
|
one_hour_after=$(get_current_date_with_delta "1")
|
||||||
|
two_hours_after=$(get_current_date_with_delta "2")
|
||||||
|
|
10
doc/holidays/.editorconfig
Normal file
10
doc/holidays/.editorconfig
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = false
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
6
ext/summary.py
Executable file
6
ext/summary.py
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
for line in sys.stdin:
|
||||||
|
print line.strip()
|
23
pullupbranches
Executable file
23
pullupbranches
Executable file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
current_branch=$(git symbolic-ref HEAD 2>/dev/null) || { echo "you are on a unnamed branch" ; exit 1 ; }
|
||||||
|
current_branch=${current_branch##refs/heads/}
|
||||||
|
|
||||||
|
git diff-index --quiet HEAD -- || { echo "you have unstaged changes" ; exit 1 ; }
|
||||||
|
|
||||||
|
branches=$(git for-each-ref --format='%(refname:short)' refs/heads/)
|
||||||
|
|
||||||
|
echo "We are currently on ${current_branch}"
|
||||||
|
|
||||||
|
for branch in ${branches}; do
|
||||||
|
if [[ ${branch%%/*} == 'feature' || ${branch} =~ TI-[0-9]+ ]] ; then
|
||||||
|
git checkout ${branch}
|
||||||
|
git rebase 1.1.0 || break
|
||||||
|
else
|
||||||
|
echo "skipping branch ${branch}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
git checkout ${current_branch}
|
||||||
|
|
36
src/GranularDatetime.cpp
Normal file
36
src/GranularDatetime.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#include "GranularDatetime.h"
|
||||||
|
#include <Datetime.h>
|
||||||
|
#include <timew.h>
|
||||||
|
#include <format.h>
|
||||||
|
|
||||||
|
GranularDatetime::GranularDatetime(Rules &rules, const std::string &input, const std::string &format) : Datetime()
|
||||||
|
{
|
||||||
|
if (!input.empty()) {
|
||||||
|
std::string::size_type start = 0;
|
||||||
|
if (! parse (input, start, format))
|
||||||
|
throw ::format ("'{1}' is not a valid date in the '{2}' format.", input, format);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug (::format ("Granular time, input {1}", this->toISOLocalExtended()));
|
||||||
|
|
||||||
|
if (rules.has("record.granularity"))
|
||||||
|
this->correct_for_granularity(rules.getInteger("record.granularity", 0));
|
||||||
|
|
||||||
|
debug (::format ("Granular time, output {1}", this->toISOLocalExtended()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GranularDatetime::correct_for_granularity(int granularity)
|
||||||
|
{
|
||||||
|
debug (::format ("Granularity set to {1}", granularity));
|
||||||
|
|
||||||
|
int seconds = this->second();
|
||||||
|
int minutes = this->minute();
|
||||||
|
|
||||||
|
debug (::format ("Seconds {1}, minutes {2}", seconds, minutes));
|
||||||
|
|
||||||
|
int minute_delta = granularity == 0 ? 0 : minutes % granularity;
|
||||||
|
|
||||||
|
debug (::format ("Seconds {1}, minutes {2}", seconds, minutes-minute_delta));
|
||||||
|
|
||||||
|
this->_date -= minute_delta*60 + seconds;
|
||||||
|
}
|
16
src/GranularDatetime.h
Normal file
16
src/GranularDatetime.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef GRANULARDATETIME_H
|
||||||
|
#define GRANULARDATETIME_H
|
||||||
|
|
||||||
|
#include <Rules.h>
|
||||||
|
#include <Datetime.h>
|
||||||
|
|
||||||
|
class GranularDatetime : public Datetime
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GranularDatetime(Rules &rules, const std::string& input = "", const std::string& format = "");
|
||||||
|
|
||||||
|
private:
|
||||||
|
void correct_for_granularity(int granularity);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRANULARDATETIME_H
|
35
src/LegacyRulesWrapper.cpp
Normal file
35
src/LegacyRulesWrapper.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#include <LegacyRulesWrapper.h>
|
||||||
|
|
||||||
|
LegacyRulesWrapper::LegacyRulesWrapper(Rules &rules)
|
||||||
|
: _rules(rules)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool LegacyRulesWrapper::has (const std::string& key) const
|
||||||
|
{
|
||||||
|
return _rules.has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LegacyRulesWrapper::get (const std::string& key) const
|
||||||
|
{
|
||||||
|
return _rules.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LegacyRulesWrapper::getInteger (const std::string& key, int defaultValue) const
|
||||||
|
{
|
||||||
|
return _rules.getInteger(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
double LegacyRulesWrapper::getReal (const std::string& key) const
|
||||||
|
{
|
||||||
|
return _rules.getReal(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LegacyRulesWrapper::getBoolean (const std::string& key) const
|
||||||
|
{
|
||||||
|
return _rules.getBoolean(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector <std::string> LegacyRulesWrapper::all (const std::string& stem = "") const
|
||||||
|
{
|
||||||
|
return _rules.all(stem);
|
||||||
|
}
|
24
src/LegacyRulesWrapper.h
Normal file
24
src/LegacyRulesWrapper.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef INCLUDED_LEGACYRULESWRAPPER
|
||||||
|
#define INCLUDED_LEGACYRULESWRAPPER
|
||||||
|
|
||||||
|
#include <Rules.h>
|
||||||
|
#include <RulesProvider.h>
|
||||||
|
|
||||||
|
class LegacyRulesWrapper : public RulesProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit LegacyRulesWrapper(Rules &rules);
|
||||||
|
|
||||||
|
bool has (const std::string&) const override;
|
||||||
|
std::string get (const std::string&) const override;
|
||||||
|
int getInteger (const std::string&, int defaultValue) const override;
|
||||||
|
double getReal (const std::string&) const override;
|
||||||
|
bool getBoolean (const std::string&) const override;
|
||||||
|
|
||||||
|
std::vector <std::string> all (const std::string& stem) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Rules& _rules;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
16
src/RulesProvider.h
Normal file
16
src/RulesProvider.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef INCLUDED_RULESPROVIDER
|
||||||
|
#define INCLUDED_RULESPROVIDER
|
||||||
|
|
||||||
|
class RulesProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool has (const std::string&) const = 0;
|
||||||
|
virtual std::string get (const std::string&) const = 0;
|
||||||
|
virtual int getInteger (const std::string&, int defaultValue) const = 0;
|
||||||
|
virtual double getReal (const std::string&) const = 0;
|
||||||
|
virtual bool getBoolean (const std::string&) const = 0;
|
||||||
|
|
||||||
|
virtual std::vector <std::string> all (const std::string& stem = "") const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
|
// Copyright 2016, 2018, Paul Beckingham, Federico Hernandez.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -90,7 +90,7 @@ bool domGet (
|
||||||
if (pig.skipLiteral (".tag.") &&
|
if (pig.skipLiteral (".tag.") &&
|
||||||
pig.getDigits (n))
|
pig.getDigits (n))
|
||||||
{
|
{
|
||||||
if (n <= static_cast <int> (latest.tags ().size ()))
|
if (1 <= n && n <= static_cast <int> (latest.tags ().size ()))
|
||||||
{
|
{
|
||||||
std::vector <std::string> tags;
|
std::vector <std::string> tags;
|
||||||
for (auto& tag : latest.tags ())
|
for (auto& tag : latest.tags ())
|
||||||
|
|
13
test/.editorconfig
Normal file
13
test/.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = false
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[{*.py,*.t}]
|
||||||
|
indent_size = 4
|
BIN
test/IntervalSynthesizer.t
Executable file
BIN
test/IntervalSynthesizer.t
Executable file
Binary file not shown.
16
test/RulesProviderMock.h
Normal file
16
test/RulesProviderMock.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef INCLUDED_RULESMOCK
|
||||||
|
#define INCLUDED_RULESMOCK
|
||||||
|
|
||||||
|
#include <gmock/gmock.h>
|
||||||
|
#include <RulesProvider.h>
|
||||||
|
|
||||||
|
class RulesProviderMock : public RulesProvider
|
||||||
|
{
|
||||||
|
MOCK_CONST_METHOD1(has, bool (const std::string&));
|
||||||
|
MOCK_CONST_METHOD1(get, std::string (const std::string&));
|
||||||
|
MOCK_CONST_METHOD2(getInteger, int (const std::string&, int defaultValue));
|
||||||
|
MOCK_CONST_METHOD1(getReal, double (const std::string&));
|
||||||
|
MOCK_CONST_METHOD1(getBoolean, bool (const std::string&));
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
BIN
test/TagInfoDatabase.t
Executable file
BIN
test/TagInfoDatabase.t
Executable file
Binary file not shown.
BIN
test/get_all_exclusions.t
Executable file
BIN
test/get_all_exclusions.t
Executable file
Binary file not shown.
21
test/granulardatetime.t.cpp
Normal file
21
test/granulardatetime.t.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <cmake.h>
|
||||||
|
#include <timew.h>
|
||||||
|
#include <test.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void test_granular_datetime (UnitTest& t)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
int main (int, char**)
|
||||||
|
{
|
||||||
|
int planned = 1;
|
||||||
|
UnitTest t(planned);
|
||||||
|
|
||||||
|
test_granular_datetime(t);
|
||||||
|
}
|
14
test/task_modify-1.json
Normal file
14
test/task_modify-1.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"description": "Hey Foo",
|
||||||
|
"entry": "20180316T231055Z",
|
||||||
|
"modified": "20180316T232042Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "d07b40c4-5df7-409f-bf98-930e550333b3"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"description": "Hello World",
|
||||||
|
"entry": "20180316T231055Z",
|
||||||
|
"modified": "20180316T232042Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "d07b40c4-5df7-409f-bf98-930e550333b3"
|
||||||
|
}
|
15
test/task_modify-2.json
Normal file
15
test/task_modify-2.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"description": "FooBar",
|
||||||
|
"entry": "20180316T231125Z",
|
||||||
|
"modified": "20180316T231808Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"description": "FooBar",
|
||||||
|
"due": "20180331T220000Z",
|
||||||
|
"entry": "20180316T231125Z",
|
||||||
|
"modified": "20180316T231808Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094"
|
||||||
|
}
|
15
test/task_modify-3.json
Normal file
15
test/task_modify-3.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"description": "FooBar",
|
||||||
|
"entry": "20180316T231125Z",
|
||||||
|
"modified": "20180316T231808Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"description": "FooBar",
|
||||||
|
"due": "20180331T220000Z",
|
||||||
|
"entry": "20180316T231125Z",
|
||||||
|
"modified": "20180316T231808Z",
|
||||||
|
"status": "pending",
|
||||||
|
"uuid": "e11d7d19-20a7-47bb-999e-6554a70ea094"
|
||||||
|
}
|
85
test/test_csv.t
Executable file
85
test/test_csv.t
Executable file
|
@ -0,0 +1,85 @@
|
||||||
|
#!/usr/bin/env python2.7
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Copyright 2006 - 2017, Thomas Lauf, 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
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
# Ensure python finds the local simpletap module
|
||||||
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
from basetest import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestCsv(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
self.process = subprocess.Popen([os.path.join(current_dir, '../ext/csv.py')],
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
|
def test_csv_with_empty_database(self):
|
||||||
|
"""csv extension should print nothing on empty database"""
|
||||||
|
out, err = self.process.communicate(input="color: off\ndebug: on\ntemp.report.start: \ntemp.report.end: \n\n[]")
|
||||||
|
|
||||||
|
self.assertEqual('', out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_csv_with_filled_database(self):
|
||||||
|
"""csv extension should print intervals for filled database"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\",\"tags\":[\"foo\"]}]")
|
||||||
|
|
||||||
|
self.assertEqual('"20160101T070000Z","20160101T080000Z","foo"\n', out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_csv_with_interval_without_tags(self):
|
||||||
|
"""csv extension should handle interval without tags"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\"}]")
|
||||||
|
|
||||||
|
self.assertEqual('"20160101T070000Z","20160101T080000Z"\n', out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_csv_with_interval_with_empty_tag_list(self):
|
||||||
|
"""csv extension should handle interval with empty tag list"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\"}]")
|
||||||
|
|
||||||
|
self.assertEqual('"20160101T070000Z","20160101T080000Z"\n', out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
from simpletap import TAPTestRunner
|
||||||
|
|
||||||
|
unittest.main(testRunner=TAPTestRunner())
|
||||||
|
|
||||||
|
# vim: ai sts=4 et sw=4 ft=python
|
91
test/test_debug.t
Executable file
91
test/test_debug.t
Executable file
|
@ -0,0 +1,91 @@
|
||||||
|
#!/usr/bin/env python2.7
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Copyright 2006 - 2017, Thomas Lauf, 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
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
# Ensure python finds the local simpletap module
|
||||||
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
from basetest import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
class TestDebug(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
self.process = subprocess.Popen([os.path.join(current_dir, '../ext/debug.py')],
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
|
def test_debug_with_empty_database(self):
|
||||||
|
"""debug extension should print nothing on empty database"""
|
||||||
|
out, err = self.process.communicate(input="color: off\ndebug: on\ntemp.report.start: \ntemp.report.end: \n\n[]")
|
||||||
|
|
||||||
|
self.assertEqual('color: off\ndebug: on\ntemp.report.start:\ntemp.report.end:\n\n[]\n', out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_debug_with_filled_database(self):
|
||||||
|
"""debug extension should print intervals for filled database"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\",\"tags\":[\"foo\"]}]")
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
'color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\",\"tags\":[\"foo\"]}]\n',
|
||||||
|
out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_debug_with_interval_without_tags(self):
|
||||||
|
"""debug extension should handle intervals without tags"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\"}]")
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
'color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\"}]\n',
|
||||||
|
out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
def test_totals_with_interval_with_empty_tag_list(self):
|
||||||
|
"""totals extension should handle interval with empty tag list"""
|
||||||
|
out, err = self.process.communicate(
|
||||||
|
input="color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\",\"tags\":[]}]")
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
'color: off\ndebug: on\ntemp.report.start: 20160101T070000Z\ntemp.report.end: 20160101T080000Z\n\n[{\"start\":\"20160101T070000Z\",\"end\":\"20160101T080000Z\",\"tags\":[]}]\n',
|
||||||
|
out)
|
||||||
|
self.assertEqual('', err)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
from simpletap import TAPTestRunner
|
||||||
|
|
||||||
|
unittest.main(testRunner=TAPTestRunner())
|
||||||
|
|
||||||
|
# vim: ai sts=4 et sw=4 ft=python
|
43
test/timemachine
Executable file
43
test/timemachine
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# parse options/arguments
|
||||||
|
until [ -z "${1}" ] ; do
|
||||||
|
case "${1}" in
|
||||||
|
--minute)
|
||||||
|
shift
|
||||||
|
minutes="${minutes} ${1}"
|
||||||
|
;;
|
||||||
|
--hour)
|
||||||
|
shift
|
||||||
|
hours="${hours} ${1}"
|
||||||
|
;;
|
||||||
|
--day)
|
||||||
|
shift
|
||||||
|
days="${days} ${1}"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo "Unknown option '${1}'"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tests="${tests} ${1}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
for day in ${days-$(date --rfc-3339=date)} ; do
|
||||||
|
for minute in ${minutes-$(echo "0$(rand -M 60)" | sed "s|.\+\(..\)\$|\1|g")} ; do
|
||||||
|
for hour in ${hours-$(seq -w 0 23)} ; do
|
||||||
|
date="${day}T${hour}:${minute}"
|
||||||
|
for single_test in ${tests} ; do
|
||||||
|
echo "Running test ${single_test} at ${date}"
|
||||||
|
faketime ${date} ${single_test}
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo "Test ${single_test} broke at ${date}!"
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
Loading…
Add table
Add a link
Reference in a new issue