Command line

Note

The documentation in this section is aimed at people wishing to contribute to rdial, and can be skipped if you are simply using the tool from the command line.

Commands

rdial.cmdline.bug_data()

Produce data for rdial bug reports.

rdial.cmdline.fsck(ctx, globs, progress)

Check storage consistency.

Parameters
  • ctx – Current command context

  • globs – Global options object

  • progress – Display progressbar

rdial.cmdline.start(globs, task, continue, new, time)

Start task.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • continue_ – Pull task name from last running task

  • new – Create a new task

  • time – Task start time

rdial.cmdline.stop(globs, message, fname, amend)

Stop task.

Parameters
  • globs – Global options object

  • message – Message to assign to event

  • fname – Filename to read message from

  • amend – Amend a previously stopped event

rdial.cmdline.switch(globs, task, new, time, amend, message, fname)

Complete last task and start new one.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • new – Create a new task

  • time – Task start time

  • amend – Amend a previously stopped event

  • message – Message to assign to event

  • fname – Filename to read message from

rdial.cmdline.run(globs, task, new, time, message, fname, command)

Run command with timer.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • new – Create a new task

  • time – Task start time

  • message – Message to assign to event

  • fname – Filename to read message from

  • command – Command to run

rdial.cmdline.wrapper(ctx, globs, time, message, fname, wrapper)

Run predefined command with timer.

Parameters
  • ctx – Click context object

  • globs – Global options object

  • time – Task start time

  • message – Message to assign to event

  • fname – Filename to read message from

  • wrapper – Run wrapper to execute

rdial.cmdline.report(globs, task, stats, duration, sort, reverse, style)

Report time tracking data.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • stats – Display short overview of data

  • duration – Time window to filter on

  • sort – Key to sort events on

  • reverse – Reverse sort order

  • style – Table formatting style

rdial.cmdline.running(globs)

Display running task, if any.

Parameters

globs – Global options object

rdial.cmdline.last(globs)

Display last event, if any.

Parameters

globs – Global options object

rdial.cmdline.ledger(globs, task, duration, rate)

Generate ledger compatible data file.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • duration – Time window to filter on

  • rate – Rate to assign hours in report

rdial.cmdline.timeclock(globs, task, duration)

Generate ledger compatible timeclock file.

Parameters
  • globs – Global options object

  • task – Task name to operate on

  • duration – Time window to filter on

Entry points

rdial.cmdline.cli(ctx, directory, backup, cache, config, interactive, colour)

Main command entry point.

Parameters
  • ctx – Current command context

  • directory – Location to store event data

  • backup – Whether to create backup files

  • cache – Whether to create cache files

  • config – Location of config file

  • interactive – Whether to support interactive message editing

  • colour – Whether to colourise output

rdial.cmdline.main()[source]

Command entry point to handle errors.

Return type

int

Returns

Final exit code

Command support

rdial.cmdline.filter_events(__globs, __task=None, __duration='all')[source]

Filter events for report processing.

Parameters
  • __globs (ROAttrDict) – Global options object

  • __task (Optional[str]) – Task name to filter on

  • __duration (str) – Time window to filter on

Returns

Events matching specified criteria

Return type

Events

rdial.cmdline.get_stop_message(__current, __edit=False)[source]

Interactively fetch stop message.

Parameters
  • __current (Event) – Current task

  • __edit (bool) – Whether to edit existing message

Return type

str

Returns

Message to use

CLI support

class rdial.cmdline.TaskNameParamType[source]

Task name parameter handler.

convert(_TaskNameParamType__value, _TaskNameParamType__param, _TaskNameParamType__ctx)[source]

Check given task name is valid.

Parameters
  • __value – Value given to flag

  • __param – Parameter being processed

  • __ctx – Current command context

Return type

str

Returns

Valid task name

class rdial.cmdline.StartTimeParamType[source]

Start time parameter handler.

convert(_StartTimeParamType__value, _StartTimeParamType__param, _StartTimeParamType__ctx)[source]

Check given start time is valid.

Parameters
  • __value – Value given to flag

  • __param – Parameter being processed

  • __ctx – Current command context

Return type

datetime

Returns

Valid start time

rdial.cmdline.task_from_dir(__ctx, __param, __value)[source]

Override task name default using name of current directory.

Parameters
  • __ctx (Context) – Current command context

  • __param (Option) – Parameter being processed

  • __value (bool) – True if flag given

Return type

None

rdial.cmdline.task_option(__fun)[source]

Add task selection options.

Note

This is only here to reduce duplication in command setup.

Parameters

__fun (Callable) – Function to add options to

Return type

Callable

Returns

Function with additional options

rdial.cmdline.duration_option(__fun)[source]

Add duration selection option.

Note

This is only here to reduce duplication in command setup.

Parameters

__fun (Callable) – Function to add options to

Return type

Callable

Returns

Function with additional options

rdial.cmdline.message_option(__fun)[source]

Add message setting options.

Note

This is only here to reduce duplication in command setup.

Parameters

__fun (Callable) – Function to add options to

Return type

Callable

Returns

Function with additional options