feat: implement cmd_duration for bash (#144)

This commit is contained in:
Kevin Song
2019-08-13 19:49:47 -07:00
committed by Matan Kushner
parent 56f4797a25
commit 22c8c3459f
2 changed files with 73 additions and 14 deletions
+8 -3
View File
@@ -119,11 +119,16 @@ 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.
::: warning Do Not Hook the DEBUG trap in Bash
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running
`eval $(starship init $0)`, or this module **will** break.
:::
Bash users who need preexec-like functionality can use
[rcaloras's bash_preexec framework](https://github.com/rcaloras/bash-preexec).
Simply define the arrays `preexec_functions` and `precmd_functions` before
running `eval $(starship init $0)`, and then proceed as normal.
### Options
| Variable | Default | Description |