-
Notifications
You must be signed in to change notification settings - Fork 48
Generate _def.xml directly from Powershell scripts
powershell/_def.xml (www/webcmd.xml in 3.0 and previous versions) is the definition file of all "commands" of WebCommander. It defines individual commands each within .
Originally, users need to compose and maintain the XML file manually. This becomes a pain point when there are a large number of Powershell scripts to define. To make this job easier, genDefXml.ps1 is provided to generate the XML definition file automatically. It parses all Powershell scripts under powershell folder and all its' sub folders.
Powershell scripts must contain necessary information to be defined as expected. Basically, comment based help is adopted to describe the command. And parameter attributes are used to describe parameters. Please read the following guideline about the recommended format of Powershell script.
.SYNOPSIS
This is used to define a short description of the script.
The content will show on the index page as the command label.
In _def.xml, this is the @synopsis of <command>.
.DESCRIPTION
This is used to define a detailed description of the script.
The content will show on the individual command page as a
dialog.
In _def.xml, this is the <description> of <command>.
.FUNCTIONALITY
This is used to define functionalities of the script.
On the index page, commands could be filtered by functionality.
Multiple values are supported. Separate them with coma.
Each value should be a single string without white spaces.
In _def.xml, this is the <functionalities> of <command>.
If a script should not be included in _def.xml, add "noshow"
here.
To hide a script from the index page, add "hidden" here.
Param (
[parameter(
Mandatory=$true,
# only necessary when the parameter is mandatory
# in _def.xml, it's @mandatory of <parameter>
HelpMessage="Help message of the parameter1"
# help message shows in the individual command page
# in _def.xml, it's @helpmesssage of <parameter>
)]
[string]$parameter1,
...
[parameter(
HelpMessage="Help message of the parameterN"
)]
[ValidateSet(
"option1",
"option2",
...
"optionN"
)]
# a dropdown list will show for user to select
# in _def.xml, it's <options> of <parameter>
[string]
$parameterN
)