refactor(config): Move config handling to core.ps1#3242
Conversation
niheaven
left a comment
There was a problem hiding this comment.
Tested with no .scoop in $HOME, work fine with changed codes.
|
When moving config, there are two |
|
L83-L87: If config value is scoop config debug true # okay
scoop config debug false # okay
scoop config debug false # errorIt can be fixed by replacing L83-L87 with $scoopConfig | Add-Member -Force -NotePropertyMembers @{ $name = $value }That is, force add note member (we want to set it, so force is okay, no matter if there is $name) |
|
Another implementation: pre-defined config file that contains all config options with default value, so we could only modify existing value, no need to add new ones. The pre-defined one can be put in scoop's root dir and copy to config home during first run. That may help users to know what configurable options is scoop having. |
5c7cb51 to
69fea43
Compare
|
There is only one thing remaining... Since Black lines above is added by scoop itself, that's messy, I think. |
- Migrate ~\.scoop to ~\.config\scoop\config.json - Remove hashtable and hashtable_val functions because ConvertFrom-Json is enough - Add PowerShell 6 time conversion to tests
Co-Authored-By: r15ch13 <r15ch13+git@gmail.com>
Encode file in "ASCII", since "UTF8" in Powershell 5 will be "UTF8-with-BOM", while "ASCII" be "UTF8". Co-Authored-By: r15ch13 <r15ch13+git@gmail.com>
Co-Authored-By: r15ch13 <r15ch13+git@gmail.com>
|
Rebased onto |
- The main bucket of Scoop has been separated to https://github.com/ScoopInstaller/Main - Requires PowerShell 5 and newer #3330 - Improve and refactor decompression functions #3204 #3409 #3411 - Move scoop config from `~\.scoop` to `~\.config\scoop\config.json` #3242 - Add `scoop hold` and `scoop unhold` for excluding programs from updates #3444 - Refactored some Core functions #3314 #3416 - Small fix for starting processes on Windows 7 #3415 Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> Co-authored-by: Chawye Hsu <h404bi@outlook.com> Co-authored-by: Jakub Čábera <cabera.jakub@gmail.com>
~\.scoopto~\.config\scoop\config.json~\.configis used by other tools too.jsonfile extensionhashtableandhashtable_valfunctions becauseConvertFrom-Jsonis enoughConvertFrom-Jsoncan handle all data formatsconfig.ps1imports frombin\*.ps1andlibexec\*.ps1requires changes to remove thescoop aliashashtablespecific stuff.