Updated README for `chug.sh -i` and fixed log handling
This commit is contained in:
parent
56e8c1c9a2
commit
1bc9d37024
30
README.md
30
README.md
|
@ -115,6 +115,33 @@ This script is designed to be run on Mondays, after the previous week of log fil
|
|||
|
||||
The output is the output of `./do_process.sh` piped to `less` for each day, pausing so the user can go through that day's output and transfer the items to Clarizen. If no time was logged for a given day (the file does not exist), `./chug.sh` prints the missing date, but otherwise silently skips it. All seven days of the week are processed, Monday through Sunday.
|
||||
|
||||
If you're only interested in the weekly summary (and don't want the output of `./do_process.sh <date>.log | less`), you can pass the `-i` option to `./chug.sh`, like so: `./chug -i`, or if you need a prior week, e.g. `./chug -i 2`. The output will look similar to the following:
|
||||
|
||||
```
|
||||
2020-03-16
|
||||
9.05
|
||||
|
||||
2020-03-17
|
||||
10.90
|
||||
|
||||
2020-03-18
|
||||
11.96
|
||||
|
||||
2020-03-19
|
||||
7.50
|
||||
|
||||
2020-03-20
|
||||
9.38
|
||||
|
||||
2020-03-21
|
||||
0
|
||||
|
||||
2020-03-22
|
||||
0
|
||||
|
||||
Weekly Total: 48.79
|
||||
|
||||
```
|
||||
## month-pack.sh
|
||||
timetracker.py and the related `do_process.sh` and `chug.sh` scripts are designed to have each day with its own YYYY-MM-DD.log file in the current, timetracker directory. Over time, the log files in this directory can become quite numerous and unwieldy. To help combat this, `month-pack.sh` takes all the log files from the previous month, adds them to a compressed tarball, and deletes them from the directory. It is designed to be run once all of the log files for the previous month have been processed into Clarizen.
|
||||
|
||||
|
@ -150,10 +177,11 @@ Much of creating the log entries depends on specific Keyboard Maestro macros the
|
|||
2020-03-11 19:14:42: Begin [CS Support] timetracker doc
|
||||
```
|
||||
|
||||
The 'End' macro copies the category and task name from the previous 'Begin' macro, to cut down on the amount of typing (and eliminate the possibility of typos). The output using the line above would look something like this:
|
||||
The 'End' macro copies the category and task name from the previous 'Begin' macro, to cut down on the amount of typing (and eliminate the possibility of typos). It then prints another 'Begin' line, ready for the next task. The output using the line above would look something like this:
|
||||
|
||||
```
|
||||
2020-03-11 19:14:42: Begin [CS Support] timetracker doc
|
||||
2020-03-11 19:30:36: End [CS Support] timetracker doc
|
||||
2020-03-11 19:30:36: Begin
|
||||
```
|
||||
I also have Keyboard Maestro text string triggers for common categories, to minimize typing. For instance, the text string triggers `[css` becomes `[CS Support] `, `[non` becomes `[Productive Non-billable] `, `[mm` or `[MM` becomes `[Mass Mutual] `, `[vzw` becomes `[Verizon Wireless] `, `[pin` becomes `[Company] ` (to match the Pindrop related items in Clarizen), etc. These are included in `timetracker.kmmacros` for your convenience.
|
||||
|
|
4
chug.sh
4
chug.sh
|
@ -17,8 +17,8 @@ for date in $(date +%F -d "${DATE}") \
|
|||
echo $date
|
||||
|
||||
if [[ -f ${date}.log ]]; then
|
||||
[[ -n $IGNORE_DO_PROCESS ]] || ./do_process.sh $date | less
|
||||
daily_total=$(./do_process.sh $date | grep -P "Grand total:" | grep -Po "\d+\.\d+")
|
||||
[[ -n $IGNORE_DO_PROCESS ]] || ./do_process.sh ${date}.log | less
|
||||
daily_total=$(./do_process.sh ${date}.log | grep -P "Grand total:" | grep -Po "\d+\.\d+")
|
||||
else
|
||||
daily_total=0
|
||||
fi
|
||||
|
|
|
@ -31,7 +31,7 @@ if [[ -f ${DATE} ]]; then
|
|||
done
|
||||
}
|
||||
|
||||
get_list_of_orgs < ${DATE}.log
|
||||
get_list_of_orgs < ${DATE}
|
||||
|
||||
# IFS=$'\n'; KEYS=($(sort -f <<< "${!ORGS[@]}")); unset IFS
|
||||
KEYS=()
|
||||
|
@ -56,7 +56,7 @@ if [[ -f ${DATE} ]]; then
|
|||
WHOLE=""
|
||||
for pattern in "${KEYS[@]}"; do
|
||||
#echo "pattern=${pattern}" >&2
|
||||
$grep -- "\[${pattern}\]" ${DATE}.log | timetracker
|
||||
$grep -- "\[${pattern}\]" ${DATE} | timetracker
|
||||
echo
|
||||
if [[ "${WHOLE}x" == "x" ]]; then
|
||||
WHOLE="${pattern}"
|
||||
|
@ -67,10 +67,10 @@ if [[ -f ${DATE} ]]; then
|
|||
done
|
||||
#$grep -Ev "${WHOLE}" ${DATE}.log | timetracker
|
||||
echo
|
||||
timetracker ${DATE}.log | $grep "Section" | sed 's/Section/Grand/'
|
||||
timetracker ${DATE} | $grep "Section" | sed 's/Section/Grand/'
|
||||
|
||||
else
|
||||
echo "${DATE}.log does not exist" >&2
|
||||
echo "${DATE} does not exist" >&2
|
||||
fi
|
||||
|
||||
#set +x
|
||||
|
|
Loading…
Reference in New Issue