diff --git a/docs/source/index.rst b/docs/source/index.rst index 539aefd..1528db9 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -556,15 +556,37 @@ auto_sheet_search_paths Not implemented. Kept for compatibility with ``timetrap``. Tracking issue: https://gitlab.com/categulario/tiempo-rs/-/issues/9 +.. _commands: + commands ........ -**Type**: CommandsSettings, +``tiempo`` allows having per-command configuration. For now it limits to +per-command default formatters introduced introduced in ``1.4.0``. To set a +default formatter other than the default ``text`` use something like this in +your settings file: + +**In toml** + +.. code:: toml + + [commands.week] + default_formatter = "chart" + +**In yaml** + +.. code:: yaml + + commands: + week: + default_formatter: chart + +To set a default formatter for every command use :ref:`default_formatter`. database_file ............. -**Type**: string **Default** Depends on OS +**Type**: string **Default**: Depends on OS Absolute path to the database file. @@ -576,6 +598,8 @@ default_command Not implemented. Kept for compatibility with ``timetrap``. Implementation planned. Tracking issue: https://gitlab.com/categulario/tiempo-rs/-/issues/10 +.. _default_formatter: + default_formatter ................. @@ -585,6 +609,9 @@ Formatter used for the :ref:`t-display` family of commands when no ``--format`` argument is passed. Included formatters are explained in the :ref:`default-formatters` section, they are: chart, text, ical, csv, json, ids. +To set a default formatter for only one command see the :ref:`commands` config +above. + .. _formatter_search_paths: formatter_search_paths @@ -595,10 +622,50 @@ formatter_search_paths Array of paths to search for custom formatters. See :ref:`custom-formatters` to learn how to write them. Custom formatters must be executable files. +.. _formatters: + formatters .......... -**Type**: FormattersSettings, +The :ref:`chart` formatter introduced in ``1.4.0`` has a few settings. It is +also possible to store settings for your custom formatters in this variable. +Take a look at the following example: + +.. code:: toml + + [formatters.earnings] + currency = "USD" + hourly_rate = 400 + + [formatters.chart] + daily_goal_hours = 4 + weekly_goal_hours = 20 + character_equals_minutes = 30 + +.. code:: yaml + + formatters: + earnings: + currency: MXN + hourly_rate: 280 + chart: + daily_goal_hours: 4 + weekly_goal_hours: 20 + character_equals_minutes: 30 + +Check :ref:`custom-formatters` to learn how to read this settings in your +formatters. + +Available settings for the :ref:`chart` formatter are: + +* ``daily_goal_hours`` (integer, default: 0) Number of hours you set as your + daily goal. Will display a uniform gray bar at the set hours that will turn + green as you make progress. +* ``weekly_goal_hours`` (integer, default: 0) Number of hours you expect to work + in a week. Controls wether the weekly hour count displays in green color. +* ``character_equals_minutes`` (integer, default: 30). Controls how many minutes + each character of the chart represents. Set lower for wider charts. Set to 0 + to make tiempo crash. .. _interactive_entries: @@ -646,41 +713,8 @@ week_start **Type**: string **Default** ``"monday"`` Day of the week that should be considered as the start for :ref:`t-week`. - -Per command default formatters -.............................. - -.. note:: - - likely move this to the section above - -**New in 1.4.0** - -It might be the case that you want to use one default formatter for when you use -``t week`` and a different one for ``t month`` or ``t today``. That's what -per-command default formatters are for. To use them just add a ``commands`` -section to your config file and set ``default_formatter`` on some formatters. -This is what it would look like: - -**In toml** - -.. code:: toml - - [commands.week] - default_formatter = "chart" - - [commands.month] - default_formatter = "ical" - -**In yaml** - -.. code:: yaml - - commands: - week: - default_formatter: chart - month: - default_formatter: ical +Options are ``"monday"``, ``"tuesday"``, ``"wednesday"``, ``"thursday"``, +``"friday"``, ``"saturday"``, ``"sunday"``. Files and paths --------------- @@ -731,6 +765,8 @@ Default formatters Tiempo comes with a handful of formatters that display your entries in different ways. Here's the full list. +.. _chart: + chart ..... @@ -750,31 +786,7 @@ chart Week 19.3/20.0 -**Settings** - -By default this formatter will only display a nice chart of the progress divided -by week and respecting the ``week_start`` setting. However you may specify a -daily goal and a weekly goal to customize the chart, as well as how many minutes -each character represents: - -In toml: - -.. code:: toml - - [formatters.chart] - daily_goal_hours = 4 - weekly_goal_hours = 20 - character_equals_minutes = 30 - -In yaml: - -.. code:: yaml - - formatters: - chart: - daily_goal_hours: 4 - weekly_goal_hours: 20 - character_equals_minutes: 30 +This formatter comes with a few settings. See :ref:`formatters` for more. text ....