joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

Configuration options #54

Closed ghost closed 5 months ago

ghost commented 1 year ago
  1. here it says that "configuration options are listed below", but nothing is listed
  2. here it talks about the configuration file, but it is not explained what are the valid configuration options. My understanding is that they are the same as the command line options, but (1) without the -- at the start, (2) with - in the middle substituted with _ (e.g. the --color-scheme command line options becomes the color_scheme config file option), and (3) command line options that don't take parameters are boolean options in the config file. I think we should write that.
ghost commented 1 year ago

Also, euporie should exit with error in case of invalid config file option

joouha commented 1 year ago
  1. It looks like I accidentally borked the scripts which generate the documentation for the configuration options and the command line flags with overzealous use of ruff (here f61cb5acbc94a7bf4d849efc203a47340b93031f). I'll fix this.

  2. Yes, the documentation could definitely be better in this regard - I'll try and add a better description of how the config file needs to be structured.

  3. Euporie does already give detailed errors about invalid config files:

    • If any part of the configuration is invalid, euporie will show a warning and fall back to using the defaults for invalid part (instead of refusing to run completely).
    • If a configuration option is invalid, it will show a warning message telling you what the permitted options are.
    • If the config file cannot be parsed, euporie will show an error message warning you of this.

    image

ghost commented 1 year ago

It doesn't throw any error in case the configuration option doesn't exist.

Take this file as an example:

{
  "app": {
    "edit_mode": "vi",
    "line_numbers": false
  },
  "notebook": {
    "edit_mode": "vi",
    "line_numbers": true,
    "autocomplete": false,
    "autosuggest": false,
    "autoinspect": false,
    "log_file": "euporie.log",
    "log_level": "debug",
    "external_editor": "nvim",
    "GIGIGIGIGI": "AAAAA"
  }
}
joouha commented 1 year ago

I've made it so non-existent configuration items in the config file are ignored deliberately, to prevent users having to manually update their config files as options are added / removed between versions.

The list of all configuration options in the documentation is working again now: https://euporie.readthedocs.io/en/latest/pages/configuration.html

ghost commented 1 year ago

I've made it so non-existent configuration items in the config file are ignored deliberately, to prevent users having to manually update their config files as options are added / removed between versions.

Not even a warning?

  1. So if I mistype an option, I think the option is active will it is not and I don't understand why?
  2. In your scenario, tmux support is removed in a future version, so I think it's still there but in reality there isn't and I don't know why?

I mean, not even a warning in stdout? A log entry?

joouha commented 1 year ago

Yes, I think a warning in the log is a good idea 👍

joouha commented 1 year ago

I've implemented log warnings on unrecognised configuration items in cbd2c73cc64d07bfa0146356f333ff8291c80f38, and it will be in the next release :robot: