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

Feature request: configuration; default values; creating records via CLI; negative ranges #3

Closed
wAuner opened this issue Feb 3, 2021 · 15 comments
Labels
ENHANCEMENT Ideas and feature requests

Comments

@wAuner
Copy link
Contributor

wAuner commented Feb 3, 2021

I've taken the time to test the release candiate and read the guide and specifications. I really like it, good job!
My main use case would be to track my working time, especially overtime. To make this as convenient as possible, I'd be really happy to have the following features:

  • a config file mechanism: maybe a user global file like ~/.klogconf. In this file I'd like to put a default directory where I keep all my records and my default "should value" and maybe addtional settings. There could even be a mechanism that looks in the local directory for a local config first, should that be necessary
  • the ability to create records/entries via the cli:
    • something like klog in to create an entry with the default "should value", date, current time and open ended entry, maybe a default tag from the config (also an option to add or omit certain values). Ideally this would automatically choose the right file, like one file for each month in the configured directory.
    • also klog out to create the corresponding value that "closes" the previous klog in
  • nice to have: allow negative ranges such as -(08:00-09:30) to be the same as -1h30m
@jotaen
Copy link
Owner

jotaen commented Feb 3, 2021

Awesome, thanks heaps for trying around and sharing your thoughts, well appreciated.

Config / default values

A config file is planned, there even is already some code for it. Complementing this with the ability to specify default values for new records is a nice idea that I will happily take on.

Default file/folder

I was thinking to adapt the idea of “bookmarking” a file in a similar way as it’s done for the MacOS widget: there you can say klog widget --file=myfile.klg to set myfile.klg as the source for the widget to read from. Technically speaking, this is accomplished via a symlink residing at ~/.klog/bookmark. The whole mechanism could be generalised to klog bookmark myfile.klg and then also be used by the cli tool.
I personally would prefer the symlink over a parameter in a config file, because it’s a) probably more transient than other configuration, and b) probably a bit easier to work with. I guess opinions might differ here, though.

The notion of an entire folder is very interesting and is something well worth to consider in the longer run, e.g. having some sort of structure where klg-files are automatically sharded into folders and files based on the year and month (e.g. ./2020/01.klg, ./2020/02.klg etc.).

Writing capabilities

That’s the next major change after the stable v1.0 release that I intend to work on. Although I have to warn you that it probably will take some time. There are a few tricky challenges to solve, like how to preserve the formatting of a file. Apart from that I want to avoid by all means that people lose data due to some silly bug that occurs when writing the data back to the file.

As a first step into that direction I wanted to add a klog new/klog create command that creates a new record (optionally with defaults from the config) and appends it to a file. That way the creation of new records is already simplified, but the risk of messing up files is still low for the time being due to append mode.

Negative ranges

Interesting that you bring that up, I had considered that as well with the exact same syntax that you were suggesting. That’s a good sign on the one hand, on the other I somehow feel that the concept of negative ranges is still a bit strange. I remain open to this, let’s see whether it comes up more often.

@jotaen jotaen changed the title Feature Request Feature request: configuration; default values; creating records via CLI; negative ranges Feb 3, 2021
@jotaen jotaen added the ENHANCEMENT Ideas and feature requests label Feb 3, 2021
@jotaen
Copy link
Owner

jotaen commented Feb 6, 2021

Bookmarking is now available in v1.0 via klog bookmark some-file.klg

@jotaen
Copy link
Owner

jotaen commented Feb 7, 2021

@wAuner, if you like you can try out v1.2 (with the hidden feature introduced in #12).

@wAuner
Copy link
Contributor Author

wAuner commented Feb 7, 2021

Thanks, I will test it during the next workweek and report back

@wAuner
Copy link
Contributor Author

wAuner commented Feb 9, 2021

I've tested it and already commented on the great feature in #12.
I like the new report and it is probably better named than eval before. It's also very nice to see the specific weekday in the report. Makes me think whether I should include a note/tag for each weekday in my records. This would make a great template placeholder, something like {{DAYOFWEEK}}.

I think it might be a good idea to include a directory with lots of test files in the repo. This would make trying out new features and testing a lot easier.

On another note: I'm not a huge fan of enforcing a specific file suffix. It really shouldn't make any difference if my file is called *.txt, *.klog or *.klg. Especially since it's all just plain text. That's just not really unix-like.

@wAuner
Copy link
Contributor Author

wAuner commented Feb 9, 2021

also I really found myself missing negative ranges. For example during lunch break, I don't want to calculate myself how long I've made a break. Shouldn't be hard to implement, since the basic functionality (duration calculation) is already there.
I think that would be another convenvience gain.

@wAuner
Copy link
Contributor Author

wAuner commented Feb 9, 2021

another thing I've noticed: I think it would be a nice idea to add klog edit which just opens the bookmarked file in the user's editor.

@jotaen
Copy link
Owner

jotaen commented Feb 9, 2021

  • Templates: thanks for your feedback 🙏 I think the general approach with the templates is good, but I’m also not super happy yet with how they are stored and referenced. Probably most people would just use one template anyway. It’s good to support multiple templates optionally, but maybe sth like default.template.klg does the trick for most use-cases. I’ll give this some further thought.
  • Test files: there used to be an example.klg in the repo. Then I deleted it, because I thought it was superfluous. I might have been wrong 👀
  • File extensions: I’m inconsistent with this, since klog total somefile.txt works, but klog bookmark somefile.txt doesn’t. I tend to agree with what you said.
  • klog edit: 👍

About the negative ranges:
To be honest, I’m still reluctant here, mostly because I’m worried that the otherwise very simple and straightforward syntax gets cluttered. I still want to understand you a bit better here: what keeps you from stopping the time and starting a new entry after the break? Like

2021-02-09
    8:39-12:14
    13:08-?

(Which btw. would become much more convenient once you can do klog start and klog stop.)

@wAuner
Copy link
Contributor Author

wAuner commented Feb 9, 2021

Concerning the negative ranges:
I was thinking the same at first and of course it is possible to just use two entries. It's just a feeling / habit to separate it this way (1 line work time, -pause on the other line) because that's what I'm used to from other time tracking solutions in companies.
I'm especially thinking on entries I make in retrospective.

But of course, that's not a requirement by any means. It would just provide an additional way to express one's personal preferences for time keeping.

@jotaen
Copy link
Owner

jotaen commented Feb 13, 2021

Covered in v1.3:

  • klog bookmark edit will open the bookmark in your favourite $EDITOR
  • You can now bookmark any files regardless of the extension

For further discussion around writing capabilities I have created a dedicated issue: #17

@jotaen jotaen closed this as completed Feb 13, 2021
@wAuner
Copy link
Contributor Author

wAuner commented Feb 14, 2021

have you considered shortening the command to just klog edit?

@jotaen
Copy link
Owner

jotaen commented Feb 15, 2021

I know it’s faster to type 😸 , however I think – from a logical perspective – an edit command only makes sense in conjunction with a bookmark. (I think no one would do klog edit some-file.klg if they can just do vi some-file.klg.) I’m still on the fence with this and considering the following things:

  • Introducing a shorthand alias for bookmark, like klog bk edit
  • The edit command could potentially be made more powerful, e.g. there could be klog edit --today which would open your $EDITOR and set the cursor to the correct line in the file (which might not be the last one). With this feature it might also be legitimate to do klog edit some-file.klg.

@wAuner
Copy link
Contributor Author

wAuner commented Feb 20, 2021

You're right, the edit command would only make sense with a bookmark and that's I would assume. So that klog edit always opens the bookmark, ideally even at the latest ? or at the end of the file. Other than that I wouldn't go too crazy with that command and keep it simple. I've made an alias for myself just with ke

@vladdeSV
Copy link
Contributor

I came across today that I needed negative ranges for lunch times. Personally I do not use the CLI that often, only when calculating totals.

Usually I do -1h lunch, but today when I am heading to the hairdresser I would like to have a time span for that break. Because of my static work times, at the start of the day I add 07:45 - 17:00 and -1h lunch. This is why I would prefer a negative time span.

Current workarounds are (as suggested above):

  • calculate break time, or
  • breaking up the total for the day

This is not a big issue, and comes up rarely. The workarounds are sufficient enough. If this is something you feel reluctant on adding @jotaen, then I think it would not be problem.

I believe it is only a bit cumbersome when you enter times manually in a text file. With sufficient tools I think this could be remedied pretty easily (either with klog or external tools).

@jotaen
Copy link
Owner

jotaen commented Mar 29, 2021

It should probably be tracked as an issue again, so I created a separate one here: #43

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