Quantcast
Channel: Windows PowerShell - SAPIEN Blog
Viewing all articles
Browse latest Browse all 308

PowerShell Studio 2014: Improved Function Builder

$
0
0

In a previous article we covered the new Function Builder. In the latest service release of PowerShell Studio 2014 (v4.1.64), we improved parameter set support in the Function Builder.

SNAGHTML31bf1a

As you can see, we altered the ordering of the fields to improve the over-all work flow of the tool.

Notice the question marks? If you hover or click on a question mark, a help message will popup explaining the respective field.

image

Parameter Sets

The Parameter Set field has been expanded to include an Output Type. Now you can specify an optional output type for each parameter set you define.

image

When a parameter set is defined, the Function Builder reacts accordingly. For example, the Parameter Set Filter is enabled and a Parameter Set column is added to the Parameters list.

SNAGHTML356039 image
(Before a Parameter Set is defined) (After a Parameter Set is defined)

 

Parameters

The biggest change to the Function Builder is the parameters section. The columns have been reordered to create a better flow when defining parameters.

The Parameter Set column has been changed from a single selection combo box, to a text field where multiple parameter sets can be defined. You can simply type in the name of the parameter set you wish to assign to the parameter:

 image

You can also define a new parameter set within this field:

SNAGHTML38c909

Or assign multiple parameter sets to a single parameter by using a comma separator.

image

The Pos column is another new addition. This is an optional field where you can quickly define the parameter’s position attribute. By default, the parameter’s position is determined by the ordering of the parameters.

 image

For parameters that are assigned to multiple parameter sets, you can define each position by using a comma separator. The position values should follow the same ordering as the parameter set assignments.

Of course, you can also assign the parameter’s position and parameter sets using the parameter’s editor dialog by clicking the edit button:

image

We updated the Parameter Dialog’s Parameter Set section to allow you to assign multiple parameter sets:

image

Note that each parameter set has its own respective settings:

image

Parameter Set Filter

Another new addition to the Parameters section is the Parameter Set Filter.

image

The Parameter Set Filter allows you to either show all the parameters, only show the parameters that are not assigned to a parameter set, or only show parameters within a specific parameter set. Selecting a filter other than “Show All” allows you to work within that specific parameter set.

image

While in this mode, you can use the up and down menu buttons to move or swap the parameter positions.

For your convenience, the position field now only shows the parameter’s position with-in the selected parameter set and no longer lists the other parameter set positions when a filter is applied.

image

By default (Show All filter) the up and down move button only changes the order in which the parameters are declared in the function.

Note: In the Show All mode, the Mandatory check box refers to the parameter’s first assigned parameter set. 

 

When a parameter set is declared, the generated function will now include a switch statement to help you differentiate between the parameter sets:

    switch ($PsCmdlet.ParameterSetName)
    {
        'Name Set' {
            #TODO: Place script here
            break
        }
        'Data Set' {
            #TODO: Place script here
            break
        }
    }

 

We hope that these new additions and changes will increase your work-flow and make the creation of advanced functions with multiple parameter sets easier then ever.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,


Viewing all articles
Browse latest Browse all 308

Trending Articles