Closed ingrinder closed 4 years ago
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 type
& options
required explicit definitions, as long as providing "temporary" entry disabling and entry renaming capabilities.
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. Thanks !! Bye 👋
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 :