-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
seq date
: generalize to allow any duration for --increment
argument
#14903
Conversation
seq date
: generalize to allow any duration for --increment flagseq date
: generalize to allow any duration for --increment arg
seq date
: generalize to allow any duration for --increment argseq date
: generalize to allow any duration for --increment
argument
I haven't looked at the code yet but I'm wondering if This is a very cool addition. I really like it alot. Thanks for working on it! |
Maybe the best solution is just to remove The
I suspect |
I guess I'm ok with removing --days. I really don't like breaking changes but --periods seems a better fit with these changes. |
Another alternative is to move this logic into a separate command, |
I'd rather just have it all in |
I honestly think we should be going in the direction of using |
Agreed. I wanted to switch to |
I think we save the datetime changes for another PR. I'm not necessarily against it, although it makes getting an answer more difficult because you have to tack on a format command. |
maybe then we avoid breaking anything with this PR, merge it now/before release, and then do all of the breaking in another PR? |
I think the only way to have no breaking changes is to overload the |
I'm fine with @132ikl's suggestion of having this be a non-breaking change for now. |
maybe not ideal, but I think this is a reasonable tradeoff, as long as we do follow up at some point |
ffb2fb9
to
be6718a
Compare
See updated PR: breaking change has been mitigated, and |
be6718a
to
0eed82c
Compare
0eed82c
to
409eeb0
Compare
409eeb0
to
3c7c7c5
Compare
Thanks |
Description
This PR seeks to generalize the
seq date
command so that it can receive any duration as an--increment
. Whereas the current command can only output a list of dates spaced at least 1 day apart, the new command can output a list of datetimes that are spaced apart by any duration.For example:
Note that the default behavior remains unchanged:
The default output format also remains unchanged:
User-Facing Changes
Breaking Changes
--increment
argument no longer accepts just an integer and requires a durationEDIT: Break Change is mitigated.
--increment
accepts either an integer or duration.Bug Fix
--days
argument had an off-by-one error and would print 1 too many elements in the output. For example,New Argument
--periods
argument is introduced to indicate the number of output elements, regardless of the--increment
value. Importantly, the--days
argument is ignored when--periods
is set.Note that the
--days
and--periods
arguments differ in their functions. The--periods
value determines the number of elements in the output that are always spaced--increment
apart. The--days
value determines the bookends--begin-date
and--end-date
when only one is set, though the number of elements may differ based on the--increment
value.Tests + Formatting
I added several examples for each user-facing change in
generators/seq_date.rs
and some tests intests/commands/seq_date.rs
.After Submitting