Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify duration format #1196

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Clarify duration format #1196

wants to merge 1 commit into from

Conversation

alexbozhenko
Copy link
Contributor

@alexbozhenko alexbozhenko commented Dec 11, 2024

For someone who is not familiar with Golang's duration type(https://pkg.go.dev/time#ParseDuration), this clarification may be useful.

Before:

[alex@omenlaptop natscli]$ nats bench pub -h
usage: nats bench pub [<flags>] <subject>

Publish Core NATS messages

Args:
  <subject>  Subject to use for the benchmark

Flags:
  --sleep=DURATION          Sleep for the specified interval between publications
  --clients=1               Number of concurrent clients

After:

[alex@omenlaptop natscli]$ go run ./nats bench pub -h
usage: nats bench pub [<flags>] <subject>

Publish Core NATS messages

Args:
  <subject>  Subject to use for the benchmark

Flags:
  --sleep=DURATION          Sleep for the specified interval between publications, such as 300ms or 1m3s. Valid time units are "ns", "us", "ms",
                            "s", "m", "h"
  --clients=1               Number of concurrent clients

Should we add the same to other places where
DurationVar is used?

@ripienaar
Copy link
Collaborator

There are 54 flags or arguments that take durations. Many more prompts and other areas where durations are accepted.

We cannot add this to each one, this is better handled as a section in the README.

@ripienaar
Copy link
Collaborator

In addition to standard go duration strings we also accept:

// * "w", "W" - a week based on 7 days of exactly 24 hours
// * "d", "D" - a day based on 24 hours
// * "M" - a month made of 30 days of 24 hours
// * "y", "Y" - a year made of 365 days of 24 hours each

@alexbozhenko
Copy link
Contributor Author

@ripienaar
So where exactly should we add it?

@ripienaar
Copy link
Collaborator

A section in the readme, take a look where it would fit. Could also add it to the website docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants