January 30th, 2008

Tab Completion

PowerShell Team
PowerShell Team

Did you realize that you can use Wildcards with our tab completion?

At the very beginning of the project, we had long discussions about whether it should be "Verb-Noun" or "Noun-Verb".  One of the arguments for NOUN-VERB was that it was better for tab completion.  We expected a TON of nouns but only a few verbs.  As such, if you type VERB-<TAB>, you’d see a ton of things to choose from.   Alternatively, if you typed NOUN-<TAB>, you’d only see the VERBS that apply to that noun. 

That wasn’t a good enough reason to go NOUN-VERB.  In the end, we wanted a THINK-TYPE-GET system and VERB-NOUN makes command sequences read like English:

Get-Process |where {$_.handles -ge 500} |sort handles |format-table name,handles

So what about tab completion – are you just hosed?  NOPE.

PowerShell’s tab completion supports wildcards.  Try it yourself:

*-Pro<TAB>
*-p<Tab>
*-p*er<TAB>

 

All that said, I would be remiss if I didn’t point you to MOW’s excellent replacement for our tab completion called PowerTab.  You can get it HERE.

Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Category
PowerShell

Author

PowerShell Team
PowerShell Team

PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.

0 comments

Discussion are closed.