alecthomas / kingpin

CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expand DurationVar to support days and weeks

adowair opened this issue · comments

Today, Kingpin's DurationVar() uses time.ParseDuration() to parse duration strings. Unfortunately, time.ParseDuration does not parse durations that contain days ("d") or weeks ("w"). It'd be great to expand the implementation to support them by using str2duration.ParseDuration() from https://github.com/xhit/go-str2duration instead.