From ef3baf7ba69fac199160fdc13c8cec4ece612b14 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Mon, 19 Aug 2024 22:09:14 +0100 Subject: [PATCH] first draft of for time duration value documentation --- README.md | 1 + docs/manual.md | 2 +- docs/tips_and_tricks.md | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 docs/tips_and_tricks.md diff --git a/README.md b/README.md index 4bf9ea0..fbebdd0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/manual.md b/docs/manual.md index 15f3f00..459aada 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -283,7 +283,7 @@ enbas show --type blocked | `type` | string | true | The resource you want to mute.
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.
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.
Set to `0 seconds` to mute indefinitely | 0 seconds (indefinitely). | ### Unmute an account diff --git a/docs/tips_and_tricks.md b/docs/tips_and_tricks.md new file mode 100644 index 0000000..d4bdcee --- /dev/null +++ b/docs/tips_and_tricks.md @@ -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.
+ 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)"`