Check-in [3e3a726c11]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | New config editor (reusing Read-GuiExtraParams dialog) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3e3a726c118b8959bf9743f73d8ccbc6 |
User & Date: | mario 2018-04-10 15:29:14 |
2018-04-10
| ||
19:38 | Enabled clipboard restore by just using text version. Safeguard for $null values in Out-Gui pipe. check-in: 134dc2ae66 user: mario tags: trunk | |
15:29 | New config editor (reusing Read-GuiExtraParams dialog) check-in: 3e3a726c11 user: mario tags: trunk | |
15:28 | Move to new vars: support check-in: cd996a8738 user: mario tags: trunk | |
Added tools/plugins/configdialog.ps1.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # api: multitool # version: 0.2 # title: Config Editor # description: Update config.ps1 settings via dialog # type: inline # depends: menu # category: config # hidden: 1 # key: conf|confedit # img: tools # config: - # # Edit config settings and write config.ps1. # Now utilizes the general input params dialog. # Config storage is destructive (no custom code / comments retained). Param( $fn="$env:APPDATA\multitool\config.ps1", $options=@(), $overwrite=0, $CRLF="`r`n" ) #-- fetch options from all plugins and main scripts $options = @($menu | ? { $_.config -and $_.config.count } | % { $_.config }) $options += dir modules/*.ps*1 | % { @((Extract-PluginMeta $_).config) } $options = $options | ? { $_.name } #$options | FL | Out-String | Write-Host -f Yellow #-- rewrite varnames from $cfg (prefix "cfg.") $current_cfg = @{} $cfg.keys | % { $current_cfg["cfg.$_"] = $cfg[$_] } #-- show editor $meta = Extract-PluginMeta $e.fn $meta.vars = $options $newcfg = Read-GuiExtraParams $meta -height 600 -CURRENT_STORE $current_cfg #$newcfg | FL #-- check results if (!$newcfg) { return ; } #-- assemble to script $src = @" # x-type: config # x-api: multitool # fn: $fn # # Clicky global app/tool settings $CRLF "@ $options | % { $v = $newcfg[$_.name] switch ($_.type) { bool { $v = @('$False', '$True')[[Int32]$v] } int { $v = [String][Int32]$v } default { $v = "'$v'" } } if ($src -notmatch "(?mi)^[$]$($_.name)") { $src += '$' + $_.name + " = " + $v + "; # $($_.description)$CRLF" } } Write-Host -f Green $src; # create parent dir if ($overwrite -or !(Test-Path $fn)) { $dir = Split-Path $fn -parent if ($dir -and !(Test-Path $dir)) { md -Force "$dir" } } # (over)write $src | Out-File $fn -Encoding UTF8 #-- apply to current $cfg{} # ... |