Check-in [168d091f87]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | New menu/plugin which adds dummy entries for unclassified scripts. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | trunk |
| Files: | files | file ages | folders |
| SHA1: |
168d091f87b9c53c547bdfe7523042d6 |
| User & Date: | mario 2018-05-19 22:49:43 |
Context
|
2018-05-19
| ||
| 22:49 | New menu/plugin which adds dummy entries for unclassified scripts. Leaf check-in: 168d091f87 user: mario tags: trunk | |
| 22:47 | Shorten starter.ps1 with `Is-PluginCompatible` function, scanning user plugins with standard scripts, and moving -Filter to separate script. check-in: 74c2c89475 user: mario tags: trunk | |
Changes
Added contrib/AddPlainScriptDir.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 81 82 |
# encoding: utf-8
# api: clicky
# type: init
# version: 0.2
# title: Add plain scripts
# description: Loads undocumented scripts from given directory into Clicky menu
# category: ui
# state: beta
# config:
# { name: plain_scripts_dir, type: str, description: path to scan for undocumented PS scripts }
# { name: plain_scripts_type, type: select, select: cli|window|inline, description: how to run non-PMD scripts }
# hidden: 1
# nomenu: 1
#
# Scans a given directory for plain powershell scripts. If no PMD is
# found embeds them into the menu with dummy values.
#
# This is used to craft a list of filename-only menu entries from
# undocumented tools.
#
# default config
@{
plain_scripts_dir = "./powershell/scripts/*.ps1" # dirs to scan
plain_scripts_type = "cli" # could be inline
plain_scripts_menu = "PlainScripts" # menu name
}.GetEnumerator() | % {
if (-not $cfg.containsKey($_.Key)) { $cfg[$_.Key] = $_.Value }
}
# menuitem moving (at this point the new menu was already added in 'Extras', so just move it to main menu bar)
if ($GUI -and $GUI.w) {
if ($Menu_CAT = $GUI.w.findName("Menu_"+$cfg.plain_scripts_menu.toUpper()) ) {
$Menu_MAIN = $GUI.w.findName("Menu_CMD").Parent
$Menu_CAT.Parent.Items.Remove($Menu_CAT)
$Menu_CAT.Header = $cfg.plain_scripts_menu
$Menu_MAIN.Items.Insert(3, $Menu_CAT)
}
return
}
# reregister as init-gui (this plugin originally runs as `init`, but then should be invoked a second time in `init-gui` stage)
else {
$_.type = "init-gui" # simply adapt existing entry in $menu[]
}
# scan files, add to $menu list
$menu += @(Get-Item $cfg.plain_scripts_dir) | % {
if (Is-PluginCompatible ($meta = Extract-PluginMeta $_)) {
# pass
}
else {
# stub fields
$meta = @{
fn = $_.FullName
id = $_.BaseName
api = "powershell"
type = ($cfg.plain_scripts_type)
category= ($cfg.plain_scripts_menu.toLower())
version = "0.0"
title = $_.Name
description = "plain powershell script"
doc = "No documentation"
author = "unknown"
state = "unknown"
menu = 1
icon = "cmd"
config = @()
vars = @()
}
# try to gather something from DocBlock
if ($help = Get-Help $_.FullName) {
if ($help.NOTES) { $meta.doc = $help.NOTES }
if ($help.DESCRIPTION) { $meta.description = $help.DESCRIPTION }
if ($help.VERSION) { $meta.version = $help.VERSION }
}
}
($meta)
}
|
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 |
# 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.2
# 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
|
| ︙ | ︙ |