1

...anyone an idea? is ther a Standard?

The PowerShell "cmdlet structure" is "verb-noun" - that is nice, but leads to classes organized by Verb. Now, the PowerShell "external Interface" is detmined by the CmdLet Attribute and has not have to havea relationship with the actual class Name.

My idea is to turn this around - use NounVerb for the class so everything for a specific noun is together, then pack them possibly into namespaces according to the "prefix" in the noun (i.e. if multiple cmdlets form Groups, those go into namepaces).

This shall Keep the lsit smaller during development and makes sure all cmdlets for an oun are grouped together.

1 Answer 1

3

The most common practice I've seen (via dotPeek on S.M.A) is to name a C# cmdlet class for Verb-Noun: VerbNounCommand e.g. GetJobCommand. This is what we do for the cmdlet class names in the PowerShell Community Extensions.

OTOH, I think this is an implementation detail that is completely up to the cmdlet author. The most important thing here is to try to use an approved verb and pick a good noun (not too generic and avoid plural).

Sign up to request clarification or add additional context in comments.

3 Comments

Agree on implementation detail - problem is, I AM implementing ;) So obviously this "detail" hits me.
@TomTom I wouldn't say there is a standard - perhaps a common convention. I do find code like GetJobCommand more natural to read than JobGetCommand.
Yes, but at the same time it means you organize them by verb, not by - well - "natural grouping" ;(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.