Hacker News new | ask | show | jobs
by Riverheart 2580 days ago
I'd suggest the following.

  get-command add*group*
Or for brevity

  gcm add*group*
For reference, the Bash version is this:

  compgen -c | grep group
Edit:

Let's get crazier. You want custom tab completion to focus on the command's noun plus Bash style completion.

  $Function:OriginalTabCompletion = $Function:TabExpansion

  function TabExpansion($line,  $lastWord) {
      if ($line -match ('^!(.*)') {
          $lastWord = $lastWord.trimstart('!')
          Get-command -noun *$lastWord*
      } elseif {
          OriginalTabExpansion  $line $lastWord
      }
  }
  Set-psreadline -chord tab -function MenuComplete

  !group<TAB>
1 comments

Oh man. Somebody who really knows PowerShell. That's really rare :-)