Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --format flag and Starship integration to README.md #124

Merged
merged 1 commit into from
Jun 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ timetrace list projects
When filtering by projects, for example with `timetrace list records -p make-coffee today`, the modules of that project
will be included.

## Starship integration

To integrate timetrace into Starship, add the following lines to `$HOME/.config/starship.toml`:

```
[custom.timetrace]
command = """ timetrace status --format "Current project: {project} - Worked today: {trackedTimeToday}" """
when = "timetrace status"
shell = "sh"
```

You can find a list of available formatting variables in the [`status` reference](#print-current-status).

## Command reference

### Create a project
Expand Down Expand Up @@ -417,6 +430,21 @@ timetrace start --billable make-coffee
timetrace status
```

**Flags:**

|Flag|Short|Description|
|-|-|-|
|`--format`|`-f`|Display the status in a custom format (see below).|

**Formatting variables:**

|Variable|Description|
|-|-|
|`{project}`|The key of the current project.|
|`{trackedTimeCurrent}`|The time tracked for the current record.|
|`{trackedTimeToday}`|The time tracked today.|
|`{breakTimeToday}`|The break time since the first record.|

**Example:**

Print the current tracking status:
Expand All @@ -430,6 +458,14 @@ timetrace status
+-------------------+----------------------+----------------+
```

Print the current project and the total working time as a custom string:

```
timetrace status --format "Current project: {project} - Worked today: {trackedTimeToday}"
```

Given the example above, the output will be `Current project: make-coffee - Worked today: 3h 30min`.

### Stop tracking

**Syntax:**
Expand Down