clockify-cli report

clockify-cli report

List all time entries for a given date range

Synopsis

List all time entries for a given date range

If no parameter is set, shows today’s time entries Aliases today/now can be used for argument to represent current date Alias yesterday can be used for argument to represent previous date

To choose a specific date to start or end use the format “2006-01-02”

To be able to use names of resources instead of its IDs you must enable the feature ‘allow-name-for-id’, to do that run the command (the commands may take longer to look for the resource id):

$ clockify-cli config set allow-name-for-id true

All the subcommands have the same flags to filter and format the time entries, but will act as aliases to relative date ranges.

clockify-cli report [<start>] [<end>] [flags]

Examples

# reporting all time entries from today
$ clockify-cli report
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
|            ID            |        START        |         END         |   DUR   |   PROJECT    |          DESCRIPTION           |              TAGS              |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b87a9785815e619d7ce02e | 2022-06-26 12:25:56 | 2022-06-26 12:26:47 | 0:00:51 | Clockify Cli | Example for today              | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b87abb85815e619d7ce034 | 2022-06-26 12:26:47 | 2022-06-26 13:00:00 | 0:33:13 | Clockify Cli | Example for today (second one) | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| TOTAL                    |                     |                     | 0:34:04 |              |                                |                                |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+

# reporting all time entries from 2022-06-24 to today
$ clockify-cli report 2022-06-24 today
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
|            ID            |        START        |         END         |   DUR   |   PROJECT    |          DESCRIPTION           |              TAGS              |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b8ce7185815e619d7d0a82 | 2022-06-24 08:00:00 | 2022-06-24 09:00:00 | 1:00:00 | Clockify Cli | Example for before yesterday   | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b8ce1edba0da0f21e7e688 | 2022-06-25 08:00:00 | 2022-06-25 09:00:00 | 1:00:00 | Clockify Cli | Example for yesterday          | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b87a9785815e619d7ce02e | 2022-06-26 12:25:56 | 2022-06-26 12:26:47 | 0:00:51 | Clockify Cli | Example for today              | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| 62b87abb85815e619d7ce034 | 2022-06-26 12:26:47 | 2022-06-26 13:00:00 | 0:33:13 | Clockify Cli | Example for today (second one) | Development                    |
|                          |                     |                     |         |              |                                | (62ae28b72518aa18da2acb49)     |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+
| TOTAL                    |                     |                     | 2:34:04 |              |                                |                                |
+--------------------------+---------------------+---------------------+---------+--------------+--------------------------------+--------------------------------+

# when there are no entries for the range
$ clockify-cli report 1999-01-01
+-------+-------+-----+---------+---------+-------------+------+
|  ID   | START | END |   DUR   | PROJECT | DESCRIPTION | TAGS |
+-------+-------+-----+---------+---------+-------------+------+
| TOTAL |       |     | 0:00:00 |         |             |      |
+-------+-------+-----+---------+---------+-------------+------+

# format output with golang template
$ clockify-cli report 2022-06-23 --format "{{.ID}} - {{ .TimeInterval.Duration }} - {{ pad .Project.Name 12 }} - {{ .Description }}"
62b8d162984dba2c06699e3f - PT1H - Clockify Cli - First example for report
62b8d195dba0da0f21e7e85d - PT1H - Special      - Lunch break
62b8d207dba0da0f21e7e868 - PT1H - Clockify Cli - After lunch

# the default functions from the text/template package from Go are available, and the following functions are also allowed:
#
#  - formatDateTime(time.Time)         => format date/times with 2006-01-02 15:04:05
#  - formatTime(time.Time)             => format date/times with 15:04:05
#  - json(interface{})                 => encodes a value to json
#  - now(time.Time)                    => returns the argument or now if nil
#  - pad(s string, size int)           => adds spaces to the end of a string until its length meets the size
#  - since(s time.Time, [e time.Time]) => returns the time difference between the first and second time (or now if not set)
#  - until(e time.Time, [s time.Time]) => returns the time difference between the second and first time (or now if not set)
#  - yaml(interface{})                 => encodes a value to yaml

# show time spent on the project "Clockify CLI" as float
$ clockify-cli report 2022-06-23 --duration-float -p "clockify cli"
2.000000

# show time spent on the project "Clockify CLI" with "lunch" on description
$ clockify-cli report 2022-06-23 --duration-formatted -p "clockify cli" -d lunch
1:00:00

# show ids from time entries from project "clockify cli"
$ clockify-cli report 2022-06-23 -p "clockify cli" --quiet
62b8d162984dba2c06699e3f
62b8d207dba0da0f21e7e868

# show time entries from project "special" as markdown
$ clockify-cli report 2022-06-23 -p "clockify cli" --quiet
ID: `63b8d195dba0da0f21e7e85d`  
Billable: `no`  
Locked: `no`  
Project: Special (`6202680228782767055ef004`)  
Interval: `2023-06-23 15:00:00` until `2022-06-23 16:00:00`  
Description:
> Lunch break

Tags:
 * Meeting (`6219486e8cb9606d934ebb5f`)

# csv format output
$ clockify-cli report --csv
id,description,project.id,project.name,task.id,task.name,start,end,duration,user.id,user.email,user.name,tags...
62b87a9785815e619d7ce02e,Example for today,621948458cb9606d934ebb1c,Clockify Cli,62b87a7e984dba2c0669724d,Report Command,2022-06-26 12:25:56,2022-06-26 12:26:47,0:00:51,5c6bf21db079873a55facc08,joe@due.com,John Due,Development (62ae28b72518aa18da2acb49)
62b87abb85815e619d7ce034,Example for today (second one),621948458cb9606d934ebb1c,Clockify Cli,62b87a7e984dba2c0669724d,Report Command,2022-06-26 12:26:47,2022-06-26 13:00:00,0:33:13,5c6bf21db079873a55facc08,joe@due.com,John Due,Development (62ae28b72518aa18da2acb49)

Options

      --billable             Will filter time entries that are billable
  -c, --client string        Will filter projects from this client
  -v, --csv                  print as CSV
  -d, --description string   will filter time entries that contains this on the description field
  -F, --duration-float       prints only the sum of duration as a "float hour"
  -D, --duration-formatted   prints only the sum of duration formatted
  -e, --fill-missing-dates   add empty lines for dates without time entries
  -f, --format string        golang text/template format to be applied on each time entry
  -h, --help                 help for report
  -j, --json                 print as JSON
  -m, --md                   print as Markdown
      --not-billable         Will filter time entries that are not billable
  -p, --project strings      Will filter time entries using this project
  -q, --quiet                print only ID
  -T, --tag strings          Will filter time entries using these tags
  -S, --with-totals          add a totals line at the end

Options inherited from parent commands

      --allow-name-for-id           allow use of project/client/tag's name when id is asked
  -i, --interactive                 will prompt you to confirm/complement commands input before executing the action 
  -L, --interactive-page-size int   will set how many items will be shown on interactive mode (default 7)
      --log-level string            { none | debug | info } set log level (default "none")
  -t, --token string                clockify's token
                                    Can be generated here: https://clockify.me/user/settings#generateApiKeyBtn
  -u, --user-id string              user id from the token
  -w, --workspace string            workspace to be used

SEE ALSO

Auto generated by spf13/cobra on 29-Mar-2024