Monday, October 6, 2014

What’s in a name? Using prefixes in PowerShell.

Advertise

I've still not wrapped my head around this. Is the recommended way to write modules without prefixed names, and use DefaultCommandPrefix in the module manifest to provide a default prefix?

For example a function Get-Changeset (in source control) with a module manifest defaultcommandprefix=P4 => Get-P4Changeset.

Since most people only uses one source control system, it would be nicer for the users to be able to use Get-Changeset without the prefix, but it doesn't seem to be possible to say import-module Perforce -prefix '' (that still returns the defaultcommandprefixed name.

Is is reasonable then to not use a prefix and let the few users who are using multiple systems use import-module -prefix to resolve conflicts?

Can you elaborate with examples on how you best see this implemented?

/Staffan


No comments: