Check-in [b84bc30494]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add $menu -Filter support (for restricted wrappers). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b84bc304943d4fe36a6b9f1ceae46737 |
User & Date: | mario 2018-04-10 15:27:24 |
Context
2018-04-10
| ||
15:27 | Omit old TabItem style check-in: 9bd1f9338d user: mario tags: trunk | |
15:27 | Add $menu -Filter support (for restricted wrappers). check-in: b84bc30494 user: mario tags: trunk | |
15:26 | A bit of cleanup (var declarations moved, obsolete comments). Prevent gui params popup if only default input requested per var:/param:. Add $varname injection for Out-GuiHeader. Alternative vars_previous store support in input popup, configurable height. Theme support for WPF-Window. Show PSVersion in Write-Splash header. check-in: bd2b14ef25 user: mario tags: trunk | |
Changes
Changes to modules/starter.ps1.
1 2 3 4 5 | # api: ps # type: main # title: ClickyColoury + TextyTypey - GUI+CLI tool frontend # description: Convenience invocation of various Powershell and CMD scripts # url: http://fossil.include-once.org/clickycoloury/ | | < | | | | > > | | | > | < < < > > > > | > | 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | # api: ps # type: main # title: ClickyColoury + TextyTypey - GUI+CLI tool frontend # description: Convenience invocation of various Powershell and CMD scripts # url: http://fossil.include-once.org/clickycoloury/ # version: 0.9.0 # depends: menu, wpf, clipboard # category: misc # config: # { name: cfg.gridview, type: select, value: Format-Table, select: Format-Table|Out-GridView, description: default table display mode } # { name: cfg.cli, type: bool, value: 0, description: Start console (CLI) version per default? } # { name: cfg.cached, type: bool, value: 0, description: Use CLIXML script cache on startup } # author: mario # license: MITL # priority: core # status: stable # # Note that this is the WindowsPresentationForm version, but also renders a # classic -CLI menu otherwise. Utilizes: # # ยท guimenu.psm1 = graphical toolkit features # ยท menu.psm1 = mostly CLI features # ยท clipboard.psm1 = for the HTML output # # Whereas scripts (and plugins) reside in tools*/*.ps1 # # Starting up with `-cli` parameter should yield the text version. # # Requires powershell.exe -STA -File ... startup (for GUI mode). # #-- params [CmdletBinding()] Param( [switch]$CLI = $false, $Filter = ".*", $NotFilter = "admin" # to cut down $menu list ("ClickyInfo") ) #-- config $global:cfg = @{ domain = "WORKWORKWORKWORKWORK" # (Get-ADDomain).Netbiosname threading = 1 autoclear = 300 exchange = @{ ConfigurationName = "Microsoft.Exchange" ConnectionUri = "http://YOUREXCHANGESRV/psremote/" } main = @{} theme = "dark" curr_script_fn = $MyInvocation.MyCommand.Path multitool_base = (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)) user_config_fn = "$env:APPDATA\multitool\config.ps1" user_plugins_d = "$env:APPDATA\multitool" tools_cache_fn = "./data/tools.cache.clixml" tool_dirs = @("./tools/*/*.ps1") # add custom dirs here! } $global:plugins = @{ "init" = @() "before" = @() "after" = @() "menu" = @() } #-- load user config cd ($cfg.multitool_base) if (Test-Path ($cfg.user_config_fn)) { . ($cfg.user_config_fn) } if ($Debug) { $cfg|FL } #-- restart if not in single-thread-apartment mode if (-not [System.Management.Automation.Runspaces.Runspace]::DefaultRunSpace.ApartmentState -eq "STA") { # powershell.exe -STA -ExecutionPolicy unrestricted -File $curr_script_fn # break 2 } #-- modules $global:GUI = [hashtable]::Synchronized(@{Host=$Host}) Import-Module -DisableNameChecking "$($cfg.multitool_base)\modules\guimenu.psm1" Write-Splash "Loadiing Modules.." 30 Import-Module -DisableNameChecking "$($cfg.multitool_base)\modules\menu.psm1" Import-Module -DisableNameChecking "$($cfg.multitool_base)\modules\clipboard.psm1" if (!(Get-Module -Name ActiveDirectory)) { Import-Module ActiveDirectory } #-- scan tools/plugins Write-Splash "Scanning Plugins.." 150 $cfg.main = (Extract-PluginMeta $cfg.curr_script_fn) #-- predefined menu entries $menu = @( ) #-- load cache? if ($cfg.cached -and (Test-Path ($cfg.tools_cache_fn))) { $menu = Import-CliXml ($cfg.tools_cache_fn) } #-- add menu entries from scripts else { $menu += @(Get-Item ($cfg.tool_dirs) | % { Extract-PluginMeta $_ } | ? { $_.api -and $_.type -and $_.title }) } #-- filter entries (e.g. $Filter="info|user|wmi" to show only a subset of safe/read-only scripts) if ($Filter) { $menu = $menu | ? { (($_.category, $_.fn, $_.description, $_.title) -match $Filter) -notmatch $NotFilter } } #-- add user plugins if (Test-Path ($cfg.user_plugins_d)) { $menu += @(Get-Item "$($cfg.user_plugins_d)/*.ps1" | % { Extract-PluginMeta $_ } | ? { $_.type -and $_.api -eq "multitool" }) } #-- run `type:init` plugins here Write-Splash "Init Plugins.." 55 $menu | ? { $_.type -eq "init" -and $_.fn } | % { . $_.fn } #-- CLI mode if ($CLI) { Write-Splash "Done" 1000 cls ; Init-Screen $menu = $menu + @{key="m|menu"; category="extras"; title="print menu"; func='Print-Menu $menu'} Print-Menu $menu Process-Menu -Menu $menu -Prompt "Typey" } #-- WPF multi-tool else { Write-Splash "Starting GUI version.." 50 $cfg.main.title = "Clicky" $shell = Start-Win (Sort-Menu $menu) } #-- cleanup if ($Debug) { Remove-Module wpf $Error } |