-
-
Notifications
You must be signed in to change notification settings - Fork 39
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] [BREAKING] Change configuration layout #80
Conversation
The patch everyone was waiting for !! 😱 Thanks for this, 🙂 As it's a "proposal", what do you think about something like this : {
"allow_overriding": true,
"parallel_loading": true,
"suppress_warnings": false,
"entries": [
{ "User" : true }, // Enabled
{ "Hostname" : {} }, // Disabled(?)
{ "Model" : null }, // Disabled
{ "Distro" : false }, // Disabled
{ "Kernel" : true },
{ "Uptime" : true },
{ "WindowManager" : true },
{ "DesktopEnvironment" : true },
{ "Shell" : true },
{ "Terminal" : true },
{ "Packages" : true },
{ "Temperature" : {
"char_before_unit": " ", // Options are simple entry's keys
"sensors_chipsets": [],
"use_fahrenheit": false
}
},
{ "CPU" : {
"name" : "Processor" // Entry name overriding
}
},
{ "GPU" : {
"one_line": true,
"max_count": 2,
"disabled": true // Disabled(!!) [handy when we temporary wanna hide an entry without losing its config]
}
},
/* ... */ It would remove OUTDATED : Check below commits description for a simpler proposal. 👋 |
Hey Michael ! I've postponed the milestone to the end of August, tell me whether you thing it is do-able or not when you can, bye 👋 |
@ingrinder hey again Michael, do you think you will be able to spare some time in the near future to officially finish ongoing work ? Just tell me whether I should keep up alone or not. |
This commit closes #57. `config.json` has been reshuffled so that entries are now each a dict, with `type` and `options` keys. Entries now have an extra `entry_options` attribute, which has options for that specific entry instance. Additionally, entries' default behaviour is now primarily defined inside each entry. + Entries have new `entry_options` attribute. + Entries can be rearranged in the configuration. + Entries can be specified multiple times in the configuration, with each one having independent options from the others. * Various miscellaneous changes to support the new `entry_options` attribute. * `LanIp` and `WanIp` renamed to `LanIP` and `WanIP` respectively. * Corrects `Raspberry` spelling :)
- Simplifies entries options implementation by avoiding nested dictionaries - Stops providing a global `Configuration` reference to entries (only one to `default_strings` for i18n) - Sets `use_unicode` option as `Terminal`-specific - Sets `honor_ansi_color` option as project-global - Renames `RAM` `warning` & `danger` options to `{warning,danger}_use_percent` (as `Disk` ones) * Keeps previous `WAN_IP` & `LAN_IP` spellings for BC purposes * Adds omitting new `Processes` entry to default configuration template * Sets `Disk.get_df_output_dict` as private method + Implements temporary entry hiding (`disabled` option field) + Defaults entry `name` attribute to instantiated class name + Allows entry renaming (`name` option field) + Fixes `Disk` behavior when no configuration options are passed + Extends documentation of new configuration layout in README
3ede61e
to
5ea6416
Compare
`config.json` has been reshuffled so that entries are now represented as a dict with `type` as long as their respective options as keys. + Entries order can be rearranged from configuration (closes #57) + Entries now have an extra `options` attribute, which contains their own settings + Entries can be specified multiple times in the configuration with each one having independent options from the others + Implements temporary entry hiding (`disabled` option field) + Defaults entry `name` attribute to instantiated class name + Allows entry renaming (`name` option field) + Adapts documentation of new configuration layout in README * Various miscellaneous changes to support the new `entry_options` attribute. * `LanIp` and `WanIp` internally renamed to `LanIP` and `WanIP` respectively * Sets `Disk.get_df_output_dict` as private method * Fixes `Raspberry` spelling :) - Stops providing a global `Configuration` reference to entries (only one to `default_strings` for i18n) - Sets `use_unicode` option as `Terminal`-specific - Sets `honor_ansi_color` option as project-global Co-authored-by: Samuel FORESTIER <dev@samuel.domains>
Description
This PR is is to enable configuration rearrangement, as in #57.
Apologies that this is in the form of a single squashed commit... however I rebased this branch quite a lot of times and the history was a mess, so it got squashed into one.
While I've provided an implementation here, if you don't think it's suitable we can also use this PR to discuss an alternative.
Reason and / or context
See #57.
Changes
dict
s containing theirtype
andrespective options.options
keysEntry
subclasses now haveentry_options
options
as an attribute, which contains the entry-specific options.These changes are all breaking to anybody with a configuration file (as it will now be unusable and crash Archey 😦). This could be very similarly implemented using entries' options as dict values on the keys already present, however this won't allow for the multiple-entry specifying I mentioned earlier.
Alternatively, we could add code to handle old configuration files... With a warning to update it, or automatically convert it to this format? This is still pretty awkard though.
How has this been tested ?
Types of changes :
Checklist :