feat: implement timer module (#118)

Implement a timer module that takes a commandline argument, the number of seconds the last job took to complete, and displays it if appropriate.

Alters shell initialization files to compute this number using date +%s where needed.

Adds a config section to configure minimum amount of time before timer is shown (default is 2s)
This commit is contained in:
Kevin Song
2019-08-08 10:25:30 -07:00
committed by Matan Kushner
parent b2303d5d8e
commit 3daf3ddf26
8 changed files with 280 additions and 16 deletions
+28
View File
@@ -109,6 +109,33 @@ command had an unsuccessful status code (non-zero).
symbol = ""
```
## Command Duration
The `cmd_duration` module shows how long the last command took to execute.
The module will be shown only if the command took longer than two seconds, or
the `min_time` config value, if it exists.
::: warning NOTE
Command duration is currently not supported in `bash`. See
[this issue](https://github.com/starship/starship/issues/124) for more details.
:::
### Options
| Variable | Default | Description |
| ---------- | ------- | ----------------------------------- |
| `min_time` | `2` | Shortest duration to show time for. |
| `disabled` | `false` | Disables the `cmd_duration` module. |
### Example
```toml
# ~/.config/starship.toml
[cmd_duration]
min_time = 4
```
## Directory
The `directory` module shows the path to your current directory, truncated to
@@ -366,3 +393,4 @@ The module will be shown if any of the following conditions are met:
[username]
disabled = true
```