Configuration

The rtimelog program uses the file ~/.timelogrc if it exists.

The configuration file is expected to contain data in two major parts:

General Configuration

The first section defined general configuration information in a key=value format. The recognized keys are:

  • editor

    The editor to use when opening the timelog file with the edit command. If not specified, it will use the value of either the VISUAL or EDITOR environment variables. If none are found, it will default to vim.

  • browser

    The browser command to use when displaying the report generated by the chart command. If not specified, it will use a hard-coded value of chromium, except on Mac OS, where it will use open.

  • dir

    The directory in which to find the timelog data files. Defaults to the timelog directory in the user’s home directory.

  • defcmd

    The default command to be used if none is supplied to timelog. By default, this is the curr command.

Configuration

editor=/usr/bin/vim
dir=~/timelog
defcmd=curr
browser=firefox

Command Aliases

The configuration file may also contain an ‘[alias]’ section that defines command aliases. Each alias is defined as a shortname=expansion string.

For example, if you regularly need to make entries for reading email and triaging bug reports you might want the following in your configuration.

Configuration

[alias]
  email = start +Misc @Email
  triage = start +BugTracker @Triage

Alias Templates

After using rtimelog for a period of time, you will likely find groups of aliases that repeat, with a small number of variations.

I found that I often needed a small set of aliases that were the same except for variations on the project name. The obvious solution for that problem is aliases that work as templates with replaceable parameters.

Configuration

[alias]
  code  = start +client:{} @Code
  doc   = start +client:{} @Doc
  test  = start +client:{} @Test

The string {} in the expansion string for an alias marks each of these aliases as a template alias. When one of these is used, the first argument after the alias name replaces the first {} string when the alias is expanded. If there is more than one {} in the template alias, each one will take another argument from the command line to replace each {}. If there are more {} than arguments, any {} without a corresponding argument will be left untouched.

Any arguments left after all {} have been replaced will remain on the end of the command.

Assuming the aliases above, if we used the code alias as follows:

  $ rtimelog code Bob New UI

The resulting expanded alias would be the following:

  $ rtimelog start +client:Bob @Code New UI

On the other hand, you could use the doc alias without following arguments, like this

  $ rtimelog test

The expanded alias would be

  $ rtimelog start +client:{} @Test