comodoro icon indicating copy to clipboard operation
comodoro copied to clipboard

Make config preset closer to other Pimalaya tools' account

Open arcstur opened this issue 1 year ago • 6 comments

Where can I find the documentation? I could not find this project (or other Pimalaya projects) in SourceHut.

arcstur avatar Oct 03 '24 16:10 arcstur

I'm sorry, I recently refactored the Pimalaya projects structure, and I did not yet take care of Comodoro. Let's keep this issue as a reminder. The best documentation you can find for now is the sample file and the --help argument.

soywod avatar Oct 03 '24 18:10 soywod

To summarize: all moved back to GitHub due to visibility and structure issue. Best place to start is pimalaya.org and the Pimalaya GitHub Organization.

soywod avatar Oct 03 '24 19:10 soywod

Because this seems important to understand t/ reverse-engineer he design from the config:

  • What is the semantical meaning of a "preset"?
  • Why does it have the tcp configuration option as a child config? (because this fact blocks me from making complete sense of it)
  • Bonus: why does the CLI require to set the protocol? (maybe the CLI is not meant for human consumption, but if it is, this seems like overly complex: Usage: comodoro start <preset> <protocol>)

blaggacao avatar Feb 09 '25 12:02 blaggacao

What is the semantical meaning of a "preset"?

A preset is a group of settings identified by a unique name. It is exactly like Himalaya and Neverest accounts.

Why does it have the tcp configuration option as a child config? (because this fact blocks me from making complete sense of it)

It used to be the case in Himalaya or Neverest, but not anymore. The aim was to simplify definitions, but error messages became a nightmare to debug. After refactor #16, it should look like this:

protocol.type = "tcp"
protocol.host = "localhost"
protocol.port = 1234

Why does the CLI require to set the protocol? (maybe the CLI is not meant for human consumption, but if it is, this seems like overly complex: Usage: comodoro start <preset> <protocol>)

If I remember well, I initially thought that a same preset could define multiple protocols (actually only TCP is available). This way you could make the server start multiple protocol at once. Let's say you define TCP and HTTP, you could start the server with comodoro server start preset my-tcp my-http. When using the client, you need to precise which protocol you want to use between TCP and HTTP.

soywod avatar Feb 17 '25 14:02 soywod

If I remember well, I initially thought that a same preset could define multiple protocols (actually only TCP is available). This way you could make the server start multiple protocol at once. Let's say you define TCP and HTTP, you could start the server with comodoro server start preset my-tcp my-http. When using the client, you need to precise which protocol you want to use between TCP and HTTP.

Hm, I see. Maybe that implementation detail can be hidden into a default protocol in the configuration or something similar, so that the CLI becomes more crisp and close to the intent: comodoro timer start (the default preset) & comodoro timer start my-non-default — a bit like himalaya & neverest have their default accounts.

But I definitely don't want to type the protocol every time, in fact I spent 4 hours to come up with this shell alias which still does some CLI completion (and it still doesn't work well):

function com() {
  comodoro timer $1 default tcp
}
function _com() {set -- comodoro timer; line=(comodoro timer); words=(comodoro timer ""); ((CURRENT += 1)); _comodoro}
compdef _com com

blaggacao avatar Feb 19 '25 09:02 blaggacao

Hm, I see. Maybe that implementation detail can be hidden into a default protocol in the configuration or something similar, so that the CLI becomes more crisp and close to the intent: comodoro timer start (the default preset) & comodoro timer start my-non-default — a bit like himalaya & neverest have their default accounts.

Indeed, it would make the API simpler. Spawning multiple binders at the same time is rather exceptional. Let's keep this issue for that specific purpose.

soywod avatar Feb 21 '25 10:02 soywod

See https://github.com/pimalaya/comodoro/issues/20#issuecomment-2890424578, the new (simpler) API is on master and should make things less awkward. Doc is on its way, meanwhile you can have a look at the new config.sample.toml.

soywod avatar May 19 '25 10:05 soywod