Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

Powertab 0.92 PowerShell improved TabExpansion function library

 

And another update in the PowerTab PowerShell TabExpansion series , a new version of the PowerShell tabExpansion script library, PowerTab 0.92  is released, with again, I think, some really cool additions !

Main addition is, that in Version 0.92  PowerTab does also support parameter completion on Functions and scripts, so you will have instant parameter tabcompletion on your self created Functions and scripts !

PowerTab092.Zip Download  or get it from the Overview Page !

If you are using PowerTab  for the first time with this version , as there is a lot of functionalty added to the standard tabcompletion to make best use of it, be sure to check out the rest of the series !,

For more information about the PowerTab suite see the PowerTab Overview Page where you allways can find the latest version for download, or you can use the TagList PowerTab to get a list of all former posts about the PowerTab library.

* Upgraders note * , if you not use the PowerTabSetup.PS1 setup routine , or skip profile change, there is one extra profile line,  :

. '$installDir\Get-ScriptParameters.ps1'  # Get Parameters of Scripts

List of updates from version 0.91 :

  • Parameter Completion on Functions and Scripts
  • Renaming of some utility scripts to better follow PowerShell naming rules
  • get-TabExpansion now also supports Type and WMI searching.
  • "In Place" invokation
  • Updated setup script ( PowertabSetup.PS1 )
  •  CustomLib.PS1 example library added
  • removed databases for aliases, functions and cmdlets (not used for some time)
  • added Add-TabExpansionEnumFromLastError Function to Library
  • Other small changes

PowerTab092.Zip Download

Parameter Completion on Functions and Scripts

 You now have instant tabcompletion on your own created functions and scripts ! :

From the moment you define a function you can Tabcomplete on the parameters, but more it also workd on scriptfiles ! , see the following examples :

PoSH> function test ($foo,$bar,$foobar) {'Function Parameter Completion'}                                               
PoSH> test -                                                                                                            
PoSH>         -                                                                                                         
PoSH>         -bar                                                                                                      
PoSH>         -foo                                                                                                      
PoSH>         -foobar                                                                                                   
PoSH>          [ 1 of 3 ]                                                                                               
PoSH>                                                                                                                   
PoSH> Set-Content TestScript.ps1 @'                                                                                     
>> # This is a test Script                                                                                              
>> PARAM ($foo,[string]$string,                                                                                         
>>        $Mandatory = (trow 'Mandatory'),                                                                              
>>        [Switch]$verbose                                                                                              
>>       )                                                                                                              
>> "Script Parameter completion"                                                                                        
>> '@                                                                                                                   
>>                                                                                                                      
PoSH> F:\PowerShell\TestScript.ps1 -                                                                                    
PoSH>                                 -                                                                                 
PoSH>                                 -foo                                                                              
PoSH>                                 -Mandatory                                                                        
PoSH>                                 -string                                                                           
PoSH>                                 -verbose                                                                          
PoSH>                                  [ 1 of 4 ]                                                                       
PoSH> help -                                                                                                            
PoSH>         -                                                                                                         
PoSH>         -Category                                                                                                 
PoSH>         -Component                                                                                                
PoSH>         -Detailed                                                                                                 
PoSH>         -Examples                                                                                                 
PoSH>         -Full                                                                                                     
PoSH>         -Functionality                                                                                            
PoSH>         -Name                                                                                                     
PoSH>         -Parameter                                                                                                
PoSH>         -Role                                                                                                     
PoSH>          [ 1 of 9 ]                                                                                                         

  Also as you see above, that now parameter completion on Help also works, what I find very hady in this case, as this is a function not an alias to help-object as you might think

Renaming of some utility scripts to better follow PowerShell naming rules, :

On request of Jeffrey Snover himself (and who with a PoSH mind can refuse that ? , Sorry I'm so late with it J )

Load save- -> import export

Refresh -> update

Find -> Get

also I changed Edit-TabExpansion to Invoke-TabExpansionEditor

So the new list of helper functions is :

PowerTab Utility functions :

Name
----
add-tabExpansion
add-TabExpansionComputersNetView
add-TabExpansionComputersOU
add-tabExpansionEnum
Add-TabExpansionEnumFromLastError
Export-tabExpansionDataBase
get-tabExpansion
get-TabExpansionComputer
get-TabExpansionCustom
Import-TabExpansionDataBase
Invoke-TabExpansionEditor
New-tabExpansionDataBase
Remove-tabExpansion
Update-TabExpansion
Update-TabExpansionTypes
Update-TabExpansionWmi

get-TabExpansion ( formerly Find-TabExpansion ) also supports Type and WMI searching.

 

PoSH> get-tabExpansion -                                                                                                
PoSH>                     -                                                                                             
PoSH>                     -filter                                                                                       
PoSH>                     -Type                                                                                         
PoSH>                      [ 1 of 2 ]                                                                                   
PoSH>                                                                                                                   
PoSH> get-tabExpansion -filter '*RegEx*' -Type Types | Format-Table -AutoSize                                           
                                                                                                                        
Name                                                DC NS                                                               
----                                                -- --                                                               
System.Configuration.RegexStringValidator           2  System.Configuration                                             
System.Configuration.RegexStringValidatorAttribute  2  System.Configuration                                             
System.Text.RegularExpressions.Regex                3  System.Text.RegularExpressions                                   
System.Text.RegularExpressions.RegexCompilationInfo 3  System.Text.RegularExpressions                                   
System.Text.RegularExpressions.RegexOptions         3  System.Text.RegularExpressions                                   
System.Text.RegularExpressions.RegexRunner          3  System.Text.RegularExpressions                                   
System.Text.RegularExpressions.RegexRunnerFactory   3  System.Text.RegularExpressions                                   
                                                                                                                        
                                                                                                                        
PoSH> get-tabExpansion '*Share*' WMI | Format-Table -AutoSize                                             
                                                                                                                        
name                                Description                                                                         
----                                -----------                                                                         
Win32_ConnectionShare               The Win32_ConnectionShare class represents an association between a shared resou... 
Win32_LogicalShareAccess            Association between the security settings of a share and one member of its DACL     
Win32_LogicalShareAuditing          Association between the security settings of a share and one member of its SACL.    
Win32_LogicalShareSecuritySetting   security settings for a logical file                                                
Win32_PrinterShare                  A generic association to establish dependency relationships between objects.        
Win32_SecuritySettingOfLogicalShare Security settings of a share object                                                 
Win32_Share                         The Win32_Share class represents a shared resource on a Win32 system. This may b... 
Win32_ShareToDirectory              The Win32_ShareToDirectory class represents an association between a shared reso... 
                                                                                                                        
                                                                                                                        
PoSH>                                                                                 

added Add-TabExpansionEnumFromLastError Function to Library

Added the function from PowerShell : Extract the Possible Enum values from Last Error and add to TabCompletion , to the Library for more information see that post.

Other Changes

  • "In Place" invokation , by adding invoke as type to a custom
  • Updated setup script ( PowertabSetup.PS1 ) , alias, function and Cmdlet fill gone, ask if you want to load Custom examples
  •  CustomLib.PS1 example library added
  • In the CustomLib.PS1 libary I will collect usefull sample for using the custom Tabcompletion functions and I will provide an update to it later.

    for example the PowerShell TabExtension - Part 8 Tip Use Custom Expansion to switch help Modes fast examples are provided in this library be sure to take a look at it for ideas, if you have some tips or handy examples please leave them in the comments, or send them to me and I will add them to the library !

     

    Enjoy,

    Greetings /\/\o\/\/

    Published Tuesday, May 29, 2007 2:45 PM by MoW

    Comments

    # The PowerShell Guy : PowerTab

    Tuesday, May 29, 2007 2:48 PM by The PowerShell Guy : PowerTab

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    Awesome!  Very cool features.

    Tuesday, May 29, 2007 4:18 PM by jvierra

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    @ Jviera,

    Thanks,

    your fast as alway's ;-)

    I keep myself recommended for your additions to the custom lib ;-)

    enjoy,

    Greetings /\/\o\/\/

    Tuesday, May 29, 2007 4:40 PM by MoW

    # Tab Expansion by MOW

    Just when you think it can't get any better, MOW releases a new version of his Tab Expansion scripts

    Wednesday, May 30, 2007 12:46 AM by Windows PowerShell

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    Just a note. If anyone gets the following message when going through PowerTabSetup.ps1:

    "The term 'Export-TabExpansion' is not recognized..."

    Simply execute 'Export-tabExpansionDataBase' as shown above under the new list of helper functions.

    Wednesday, May 30, 2007 2:35 AM by psyphen

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    @ psyphen,

    I made a typo while reneming it should be Export-TabexpansionDataBase, I fixed and updated the download.

    sorry for the inconvinence.

    Thanks,

    Marc

    Wednesday, May 30, 2007 3:42 AM by MoW

    # PowerTab 0.92 released

    And another update in the PowerTab PowerShell TabExpansion series, a new version of the PowerShell tabExpansion

    Wednesday, May 30, 2007 8:28 AM by Rod Trent at myITforum.com

    # leedesmond’s blog » Blog Archive » PowerTab 0.92

    Wednesday, May 30, 2007 8:44 AM by leedesmond’s blog » Blog Archive » PowerTab 0.92

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    Marc,

    Above you mention 'get-Tabcompletion ( formerly Find-Tabcompletion ) also supports Type and WMI searching'. Did you mean Get-TabExpansion?

    Also, Get-TabExpansion shows twice in the pick list as 'Get-TabExpansion' and 'get-TabExpansion' -- the only difference is the lower case 'g'

    --Greg

    Thursday, May 31, 2007 12:12 PM by Greg Wojan

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    @ Greg,

    Thanks for the reaction, I fixed the Typo I'm very used to say Tabcompletion, but as the standard function is called TabExpansion ( What I think is a better description as PowerTab does not only Completion ) so I try to say only expansion, but muscle memory is hard to fight ;-)

    could not find the Double Get-TabExpansion

    but correct casing is very hard for me also, but sometimes I try ;-)

    Greetings /\/\o\/\/

    Thursday, May 31, 2007 1:44 PM by MoW

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    I've been meaning to get round to installing this for sometime now, & finally did today.  Let me say "Awesome!"

    I had some confusion on alias completion though.  I ran the powertabsetup and answered yes to all the database questions.  Without any long winded story...How is alias expansion supposed to work?  I can't tell if it's supposed to be dynamic (like function parameter expansion) or in the database (like the .NET types).  Until I did:

    get-alias | % { add-tabExpansion $_.name $_.definition 'Alias' }

    alias expansion just didn't work for me at all.      Any tips?

    Thanks for your great contributions!

    Friday, June 01, 2007 2:44 PM by Clint Bergman

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    First off, I've got to say that TabExpansion is amazing!!

    I was wondering though, is there anyway to get power shell to include your aliases when doing tab expansion?

    Friday, June 01, 2007 6:43 PM by Brian

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    @ clint and brian,

    I changed this a couple of times, so expansion of aliases might be a bit confusing

    if PowerTab is in DoubleTab mode, you need to doubleTab to get aliases to complete

    see also : http://thepowershellguy.com/blogs/posh/archive/2007/04/16/powershell-tabextension-part-5-powertab-0-9.aspx

    and

    http://thepowershellguy.com/blogs/posh/archive/2007/04/22/powershell-tabextension-part-7-powertab-0-91-released.aspx

    as by default DoubleTab support is disabled you can set :

    $TabExpansionDoubleTabLock = $true

    to enable alias expansion.

    al Custom additions need to be suffixed with ^ now like aliases.

    to enable to add your own alliases that do not need ^ like the example |% and |? you can add it as an alias to the Custom table.

    so what Clint did :

    get-alias | % { add-tabExpansion $_.name $_.definition 'Alias' }

    will add all aliases to the Custom alias list.

    setting the variable will not use the database and complete on aliases "real-time"

    Hope this is clear, might make it in a blogpost later

    Greetings /\/\o\/\/

    Saturday, June 02, 2007 2:12 PM by MoW

    # TabExpansion for aliases

    With a freshly started PowerShell I cannot get alias tab completion to work.

    I tried several different combinations of commands to try and get it to work.

    Most involved

    $TabExpansionDoubleTabLock = $true

    and

    get-alias | % { add-tabExpansion $_.name $_.definition 'Alias' }

    Is there something I might be doing incorrectly?

    Method tab completion works...

    Monday, June 04, 2007 9:49 AM by Brian

    # PowerTab - PowerShell TabExpansion function library « MogBlog

    # PowerTab - PowerShell TabExpansion function library « MogBlog

    # PowerShell: A Gentle Introduction

    Tuesday, August 07, 2007 12:43 AM by Peter Seale's weblog

    # re: Powertab 0.92 PowerShell improved TabExpansion function library

    I have problems due to a newer framework version...

    Exception calling "LoadWithPartialName" with "1" argument(s): "Could not load file or assembly 'System.windows.forms, V

    ersion=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. This assembly is built by

    a runtime newer than the currently loaded runtime and cannot be loaded."

    At D:\bin\powershell\PowerTab\TabExpansionLib.ps1:10 char:166

    + if (-not ([appdomain]::CurrentDomain.getassemblies() |?  {$_.ManifestModule -like "System.Windows.Forms*"})) {[void][

    System.Reflection.Assembly]::LoadWithPartialName( <<<< "System.windows.forms")}

    Unable to find type [Drawing.Size]: make sure that the assembly containing this type is loaded.

    At D:\bin\powershell\PowerTab\ConsoleLib.ps1:14 char:17

    +   [Drawing.Size]$ <<<< size,

    Monday, June 16, 2008 1:14 PM by Andy Philpotts
    Anonymous comments are disabled