[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

SVN Tab Expansion for Windows Powershell

From: Arild Fines <arild.fines_at_broadpark.no>
Date: 2006-06-09 19:19:38 CEST

Attached is a Powershell script that adds TAB completion in Windows
Powershell for svn.exe subcommands and their associated options. It
generates the subcommand list and the association between subcommands and
options by parsing the output from "svn help", so it should stay up to date
for a while (unless the "svn help" output format changes drastically). The
very first time it's invoked, it will take a while (20-30 seconds) for it to
generate the mapping, but subsequent runs will reuse a cached version in
${env:TEMP}\svncompletion.ps1.

The attached script contains both the default tab expansion provided by the
shell (for paths, functions and cmdlets) as well as my SVN completion, so if
you haven't made any changes to the default (and if you have, you're
probably capable of figuring out how to merge it with your own anyway) you
can install it as follows:

* Save it somewhere as TabExpansion.ps1
* Dotsource it at startup by adding the following line to My
Documents\PSConfiguration\profile.ps1:

        . Somewhere\TabExpansion.ps1

* Ensure svn.exe is somewhere in your ${env:PATH}
* Start a new Powershell instance
* Type "svn c[TAB]" - this should force the mapping cache to be generated
and it should complete it as "svn cat". Subsequent TABs will cycle through
all commands matching c*.

Completion of options is triggered by the pattern "svn command -", where TAB
will cycle through the options appropriate for that particular command.

To refresh the cache (for example, when a new version of SVN introduces new
commands), you can either delete the ${env:TEMP}\svncompletion.ps1 file or
do "CreateSvnCompletion > ${env:TEMP}\svncompletion.ps1"

Keep in mind that for this to work, execution of scripts has to be allowed
in the shell (it's not allowed by default). This can be done by invoking the
command "set-executionpolicy remotesigned" (see "help about_signing" for
more information).

Enjoy,

--
Arild


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Received on Fri Jun 9 19:19:43 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.