mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
feat(time): Show module with time range (#992)
* Creation of range field in TimeConfig * time_range parsing * Hide time module if outside of time_range * Tidying of code, and properly handling more cases * is_inside_time_range function * Tests and fmt * Update docs * The configuration needs the 24-hours format * Fix clippy errors
This commit is contained in:
@@ -1327,11 +1327,12 @@ To enable it, set `disabled` to `false` in your configuration file.
|
||||
|
||||
| Variable | Default | Description |
|
||||
| ----------------- | --------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||
| `use_12hr` | `false` | Enables 12 hour formatting |
|
||||
| `use_12hr` | `false` | Enables 12 hour formatting. |
|
||||
| `format` | see below | The [chrono format string](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) used to format the time. |
|
||||
| `style` | `"bold yellow"` | The style for the module time |
|
||||
| `style` | `"bold yellow"` | The style for the module time. |
|
||||
| `utc_time_offset` | `"local"` | Sets the UTC offset to use. Range from -24 < x < 24. Allows floats to accommodate 30/45 minute timezone offsets. |
|
||||
| `disabled` | `true` | Disables the `time` module. |
|
||||
| `time_range` | `"-"` | Sets the time range during which the module will be shown. Times must be specified in 24-hours format |
|
||||
|
||||
If `use_12hr` is `true`, then `format` defaults to `"%r"`. Otherwise, it defaults to `"%T"`.
|
||||
Manually setting `format` will override the `use_12hr` setting.
|
||||
@@ -1345,6 +1346,7 @@ Manually setting `format` will override the `use_12hr` setting.
|
||||
disabled = false
|
||||
format = "🕙[ %T ]"
|
||||
utc_time_offset = "-5"
|
||||
time_range = "10:00:00-14:00:00"
|
||||
```
|
||||
|
||||
## Username
|
||||
|
||||
Reference in New Issue
Block a user