(Translated by https://www.hiragana.jp/)
Negative time ranges · Issue #252 · jotaen/klog · GitHub
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

Negative time ranges #252

Open
jotaen opened this issue Feb 22, 2023 · 2 comments
Open

Negative time ranges #252

jotaen opened this issue Feb 22, 2023 · 2 comments
Labels
ENHANCEMENT Ideas and feature requests

Comments

@jotaen
Copy link
Owner

jotaen commented Feb 22, 2023

The topic of negative time ranges keeps coming up, so I think klog eventually should have that. There was some discussion happening already in #109. This ticket is for discussing and figuring out some details of the feature, so please free to add comments about whatever comes to mind.

The implementation is fairly comprehensive, and the spec also needs changing – so I don’t know when I’ll get around to starting it, let alone when it’s done.

File format

Notation

I think what’s mostly clear is that the negative time range needs to be preceded by a minus sign -. There should also be a clear visual distinction in regards to regular time ranges. The following options are on the table right now:

2000-01-01
  -(15:00-16:00)
  -[15:00-16:00]
  • Parentheses ():
    • That’s both common as mathematical notation but also in daily writing, so it seems intuitive.
    • Parenthesis are already used for should totals (8h!), so it might create ambiguity – but maybe not since the should total is in a different place and obviously serves a different purpose.
  • Square brackets []:
    • Also used in math as notation for inclusive intervals (which would be the case here).
    • Might look more “technical”, as square brackets are less common than parentheses in daily writing.

In the end, there should be only one of these notations.

Open negative time range

Regular time ranges can be open (15:00-?), so it would make sense for negative time ranges to be able to be open as well.

Records are currently constrained to one open time range at most. Likewise, there should be just one open negative time range. But it would make sense for both to allow that independent of each other, to support something like:

2000-01-01
  8:00-? Work
  -(12:00-?) Lunch break

Otherwise, you would have to close the Work entry before starting a break, and you probably don’t want that.

Whitespace

Time ranges can have spaces around the dash (15:00-16:00 vs 15:00 - 16:00, both fine). Negative time ranges can have that as well. But what about:

  • - (15:00 - 16:00)
    • I’m tending to think this shouldn’t be allowed, as you could confuse it with a bullet point. I also don’t see any good reason for it.
  • -( 15:00 - 16:00 )
    • Maybe people prefer some padding inside the parenthesis? Maybe nothing wrong with this?

CLI tool

klog pause

The klog pause command currently opens a negative duration and keeps decrementing that. Once negative time ranges are there, klog pause should probably default to starting an open negative time range, so the semantics could be changed as follows:

  • klog pause would default to append a new negative open range to the record. (I.e., the counterpart of klog start.)
  • klog pause --follow (klog pause -f) would do the same, but keep the shell process open. Once you hit ^C, the open entry is closed.
  • klog pause --duration (klog pause -d) would be the “old” behaviour. (--follow/-f would be implicit here, so you can specify it as well, but also omit it, for convenience.)

There also would need to be a new command for finishing the negative open range, e.g. klog unpause or klog resume. (I.e., the counterpart of klog stop.)

@jotaen jotaen added the ENHANCEMENT Ideas and feature requests label Feb 22, 2023
@ulken
Copy link

ulken commented Feb 25, 2023

Notation

I'm voting for parentheses ().

Open negative time range

From my perspective, that's a must-have — what I'm missing/would use them for.

Whitespace

  • - (15:00 - 16:00)
    Definitely disallow.

  • -( 15:00 - 16:00 )
    I'd never use it and probably wouldn't support it, but like you say, it's hard to argue against it. I suppose you could choose not to support it initially and await popular demand?

CLI tool

The klog pause command currently opens a negative duration and keeps decrementing that. Once negative time ranges are there, klog pause should probably default to starting an open negative time range. The current behaviour could still be preserved via e.g. klog pause --duration or so. There also would need to be a new command then for finishing the pause, e.g. klog resume or so. (So in the end, there need to be the pause-equivalents for klog start and klog stop.)

That would suit my workflow perfectly 👌

@bevel-zgates
Copy link
Contributor

bevel-zgates commented Jul 22, 2024

Notation

I like accounting style () also.

Open negative time range

Makes sense to me

Whitespace

Don't really care one way or the other

CLI

Maybe klog unpause to directly tie it to its counterpart? No strong feelings.

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

No branches or pull requests

3 participants