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

ipfs name publish --lifetime option documentation inconsistent #2312

Closed
RichardLitt opened this issue Feb 7, 2016 · 3 comments · Fixed by #2314
Closed

ipfs name publish --lifetime option documentation inconsistent #2312

RichardLitt opened this issue Feb 7, 2016 · 3 comments · Fixed by #2314
Labels
topic/docs-ipfs Topic docs-ipfs

Comments

@RichardLitt
Copy link
Member

$  ipfs name publish --help
...
    -t,      --lifetime string - time duration that the record will be valid for (default: 24hrs)
...

Note that 24hrs is given as a default. However, this is not valid when passed in:

$ ipfs name publish QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ --lifetime=24hrs
Error: error parsing lifetime option: time: unknown unit hrs in duration 24hrs

How can I use the lifetime option?

@hackergrrl
Copy link
Contributor

Go's time.ParseDuration would expect the h suffix, not hrs. Great that you caught this. 👍

The parser is surprisingly flexible: I can make records valid for 10h43s15µs!

func ParseDuration(s string) (Duration, error)
    ParseDuration parses a duration string. A duration string is a possibly
    signed sequence of decimal numbers, each with optional fraction and a
    unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are
    "ns", "us" (or "µs"), "ms", "s", "m", "h".

In the future we might want to move to our own parser though, since there's no support for days, months, years, and any other larger units that'd be commonly desirable for TTLs.

@RichardLitt
Copy link
Member Author

What do you we say just include that paragraph about ParseDuration in the docs, here, for now? Thanks for figuring this out, I was a bit lost.

@RichardLitt RichardLitt added the topic/docs-ipfs Topic docs-ipfs label Feb 7, 2016
@hackergrrl
Copy link
Contributor

🐴SGTM

Maybe

    -t,      --lifetime string - time duration that the record will be valid for (default: 24h)

    This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are
    "ns", "us" (or "µs"), "ms", "s", "m", "h".

RichardLitt added a commit that referenced this issue Feb 8, 2016
This closes #2312

License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/docs-ipfs Topic docs-ipfs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants