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

PowerShell TabExtension - Part 7 PowerTab 0.91 Released

And another version of the PowerShell tabExpansion script library PowerTab is released, with some really cool additions !

PowerTab 0.91

For more information about the PowerTab suite and the rest of the series see also 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 PowerTab.

Together with Xaegr I  did some more work on the out-ConsoleList function, and we made some big improvements , you will see that Powertab is much more visual by default now . 

Out-ConsoleList improvements :

  • Filtering the list by typing
  • Tab and Shift-Tab support to walk the list
  • Page Up / Page Dn support
  • Improved performance
  • Customisable color scheme

As this improved the value of it that much, it I decided it was better to use it as default, hence I made it the standard handler for PowerTab so you will find it everywhere now ;-),

I also disabled doubletab by default to improve performance and adapted the tabexpansion fuction a bit more to improve the handing even more. ( you can still enable them again by changing the configuration variables $Tab[tab] , from the console ( see also :  PowerShell TabExtension - Part 6 Customizing PowerTab 0.9 , but note we have some more configuration variables now ):

TabExpansion improvements :

  • Made Out-Consolelist standard handler
  • Disabled DoubleTab by default for performance
  • Made DoubleTab and handling configurable on the fly
  • Enum and Constructor completion on types [regex]:tab [consolecolor]:[tab]
  • Custom Completion on ^[tab]
  • $[tab] gives list of al variables wildcardsearch
  • Same for ![tab] (Native commands), ^[tab] Custom completion and  [[tab] .Net namespaces they work without extra letter needed now
  • various other small improvements

 

new feature Usage examples :

the possibility to continue typeing after you hit tab enables you to hit tab much earlier, for example below I start with %[tab] to get all the functions, then type tabex to filter only the tabexpansion functions : and again with the variable I start by just typeing $[tab]tab

You can also see in the examples above the configuration variable you can change the behavour and colorscheme of PowerTab 0.92 on the Fly.

*Edit* for some more usage examples and Screendump's , and to look how PowerTab looks in a tasty Green,

 see Xaegr's blogentry about PowerTab 0.91 (Google English) 

Also you can see the new constructor and Enum tabcompletion above, below you can see how you can even make this more easy by creating custom aliases for enums.let's start with and example using PowerTab to find out the -executionPolicy parameter , the values allowed and how to make a shortcut EP^ for it to tabcomplete on :

 

PoSH> Set-ExecutionPolicy -e                                                                        
PoSH>                        -e                                                                     
PoSH>                        -ErrorAction                                                           
PoSH>                        -ErrorVariable                                                         
PoSH>                        -ExecutionPolicy                                                       
PoSH>                         [ 3 of 3 ]                                                            
PoSH> Set-ExecutionPolicy -ExecutionPolicy                                                          
Set-ExecutionPolicy : Missing an argument for parameter 'ExecutionPolicy'. Specify a parameter of t 
ype 'Microsoft.PowerShell.ExecutionPolicy' and try again.                                           
At line:1 char:36                                                                                   
+ Set-ExecutionPolicy -ExecutionPolicy <<<<                                                         
PoSH> [                                                                                             
PoSH>    [                                                                                          
PoSH>    [IronMath                                                                                  
PoSH>    [IronPython                                                                                
PoSH>    [Microsoft                                                                                 
PoSH>    [NTFS                                                                                      
PoSH>    [System                                                                                    
PoSH>     [ 3 of 5 ]                                                                                
PoSH> [Microsoft.                                                                                   
PoSH>              [Microsoft.                                                                      
PoSH>              [Microsoft.CSharp                                                                
PoSH>              [Microsoft.PowerShell                                                            
PoSH>              [Microsoft.SqlServer                                                             
PoSH>              [Microsoft.VisualBasic                                                           
PoSH>              [Microsoft.Win32                                                                 
PoSH>               [ 2 of 5 ]                                                                      
PoSH> [Microsoft.PowerShell.ExecutionPolicy]                                                        
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]                
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]::Unrestricted  
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]::RemoteSigned  
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]::AllSigned     
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]::Restricted    
PoSH>                                         [Microsoft.PowerShell.ExecutionPolicy]::Default       
PoSH>                                          [ 1 of 5 ]                                           
PoSH> [enum]::get                                                                                   
PoSH>           [enum]::get                                                                         
PoSH>           [enum]::GetName(                                                                    
PoSH>           [enum]::GetNames(                                                                   
PoSH>           [enum]::GetUnderlyingType(                                                          
PoSH>           [enum]::GetValues(                                                                  
PoSH>            [ 2 of 4 ]                                                                         
PoSH> [enum]::GetNames( [Microsoft.PowerShell.ExecutionPolicy] ) |% { add-t                         
PoSH>                                        add-t                                                  
PoSH>                                        add-tabExpansion                                       
PoSH>                                        add-TabExpansionComputersNetView                       
PoSH>                                        add-TabExpansionComputersOU                            
PoSH>                                         [ 1 of 3 ]                                            
PoSH> [enum]::GetNames( [Microsoft.PowerShell.ExecutionPolicy] ) |% { add-tabExpansion 'EP' $_}     
                                                                                                    
Filter                            Text                             Type                             
------                            ----                             ----                             
EP                                Unrestricted                     Custom                           
EP                                RemoteSigned                     Custom                           
EP                                AllSigned                        Custom                           
EP                                Restricted                       Custom                           
EP                                Default                          Custom                           
                                                                                                    
                                                                                                    
PoSH> Set-ExecutionPolicy ep^                                                                       
PoSH>                          ep                                                                   
PoSH>                          Unrestricted                                                         
PoSH>                          RemoteSigned                                                         
PoSH>                          AllSigned                                                            
PoSH>                          Restricted                                                           
PoSH>                          Default                                                              
PoSH>                           [ 2 of 5 ]                                                          
PoSH>                                                               

 Above you see how we can find out the type from the error and use PowerTab to find the possible vaules and you can see how easy it is to make your own shortcut's, here for modes of set-executionPolicy, but example if you want to play with the colors of the ConsoleList just make an custom alias color for the list of console colors

[enum]::GetNames([consolecolor]) |% { add-tabExpansion 'Color' $_ }

now you can do :

$[tab]tab c^[tab]

to pick a variable to change and to pick a color from the list

,you can create a complete library of snippets you can use from PowerTab like this, so this is really powerfull but don't forget to use

Save-Tabcompletion 

if you want to keep the Custom additions for new PowerShell sessions otherwise the changes made will be gone the next session.

 

Installation

 If you have version 0.9 you can just download version 0.91 from the  PowerTab Overview Page  replace the files and re-start the shell,

If you are installing for the first time you can just run PowerTabSetup.Ps1 from the installation directory ( the folder you extracted the files in ) to setup PowerTab 0.91 ( for more info about the PowerTabSetup.ps1 script and the setup process see : PowerTab 0.72 PowerShell TabExtension - Part 1 Installation  )

*Note* If you are upgrading from version PowerTab 0.8 or older, you can take care the setup will not remove old configuration from profile you need to remove this manualy, see also readme file :

Place files in directory and Run the PowerTabSetup.ps1 setup routine, if upgrading from older version you might need to clean up old config from profile
or to upgrade manualy, replace files and add following line to Profile to be able to use RawUI Tabresultselection :

. 'C:\PowerShell\PowerTab\Out-ConsoleList.ps1' # Used for RawUi ConsoleList

To end some tip's :

  • Default the list will close on backspace with not filter you can change that to a beep by setting
    • $TabExpansionCloseListOnEmptyFilter = $false
  • To do a new tabcompletion you need to change at least one character, you can exit by typing a dot (.) but it is not echoed so you can type [dot][dot][tab] to tabcomplete on the next level. 
  • %[tab] gives wildcard search so the get Csv CmdLets try :  %[tab]Csv
  • PoSH> %csv
       csv
       Export-Csv
       Import-Csv

       [ 1 of 2 ]

  • To enable doubleTab again and configure it to use Aarons Intellisense :

Add-PSSnapin lerchsnapin 
$TabExpansionDoubleTabLock = $false
$TabExpansionAlternateHandler = 'intellisense'
$TabExpansionDoubleTabEnabled = $true

Enjoy,

Greetings /\/\o\/\/

Published Sunday, April 22, 2007 4:35 PM by admin
Attachment(s): tab091.png

Comments

# The PowerShell Guy : PowerTab

Sunday, April 22, 2007 5:57 PM by The PowerShell Guy : PowerTab

# PowerShell TabExtension - Part 8 Tip Use Custom Expansion to switch help Modes fast

By default PowerShell only displays a summary of the Help available, If we want more info we can use

Monday, April 23, 2007 2:42 PM by The PowerShell Guy

# PowerShell : Extract the Possible Enum values from Last Error and add to TabCompletion

As Adam allready mentioned in : Another PowerTab update … there were 2 updates in a short time and there

Wednesday, April 25, 2007 5:22 PM by The PowerShell Guy
Anonymous comments are disabled