first draft of for time duration value documentation

This commit is contained in:
Dan Anglin 2024-08-19 22:09:14 +01:00
parent 43b6557178
commit f96899c9c9
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 26 additions and 1 deletions

View file

@ -24,6 +24,7 @@ the `main` branch mirrored to the following forges:
- **[Getting started guide](docs/getting_started.md)**: A guide to help you get started on using Enbas.
- **[Configuration reference](docs/configuration.md)**: The configuration reference documentation.
- **[User manual](docs/manual.md)**: The user manual.
- **[Tips and Tricks](docs/tips_and_tricks.md)**: Additional tips and tricks.
### Licensing

View file

@ -283,7 +283,7 @@ enbas show --type blocked
| `type` | string | true | The resource you want to mute.<br>Here this should be `account`. | |
| `account-name` | string | true | The name of the account to mute. | |
| `mute-notifications` | boolean | false | Set to `true` to mute notifications as well as statuses. | false |
| `mute-duration` | string | false | Specify how long the account should be muted for.<br>Set to `0 seconds` to mute indefinitely | 0 seconds (indefinitely). |
| `mute-duration` | [time duration value](tips_and_tricks.md#the-time-duration-value) | false | Specify how long the account should be muted for.<br>Set to `0 seconds` to mute indefinitely | 0 seconds (indefinitely). |
### Unmute an account

24
docs/tips_and_tricks.md Normal file
View file

@ -0,0 +1,24 @@
# Tips and Tricks
## The time duration value
The time duration value is a custom [flag value](https://pkg.go.dev/flag#Value) that converts a string input into a duration of time.
A typical string input would be in the form of something like `"3 days, 12 hours and 39 minutes"`.
The value can parse units in days, hours, minutes and seconds.
To ensure that your string input is parsed correctly there are simple rules to follow.
- The input must be wrapped in quotes.
- Use `day` or `days` to parse the number of days.
- Use `hour` or `hours` to parse the number of hours.
- Use `minute` or `minutes` to parse the number of minutes.
- Use `second` or `seconds` to parse the number of seconds.
- There must be at least one space between the number and the unit of time.<br>
E.g. `"7 days"` is valid, but `"7days"` is invalid.
### Example valid string inputs
- `"3 days"`
- `"6 hours, 45 minutes and 1 second"`
- `"1 day, 15 hours 31 minutes and 12 seconds"`
- `"(7 days) (1 hour) (21 minutes) (35 seconds)"`