Description
Since PipeScript 0.1.5, it's been possible to inherit commands.
Inheriting a command is similar to inheriting a class in an object-oriented language.
It can be accomplished using the inherit transpiler and the psuedo-attribute [inherit]
Inheritance is really powerfully (and can get a little complicated).
Here's a rundown of what you can do:
- You can inherit a function or script, which includes its contents inline beneath your code.
- When you inherit from a
[Cmdlet]
, inherit will include a ProxyCommand to call that Cmdlet (beneath your code) - When you inherit from an application, inheritance will create a function that accepts
[Parameter(ValueFromRemainingArguments)]
- If Inheritance is -Abstract, only parameters and other attributes should be added.
- If Inheritance is meant to -Override behavior, it should [Alias()] the original command's name
- If Inherit specifies -ProxyCommand, it will always inherit from a proxy command.
- If Inherit specifies -Dynamic, it will inherit with DynamicParameters instead of static ones, and will imply -ProxyCommand
- If Inherit specifies -ExcludeParameter/-IncludeParameter, parameters will be included or excluded from inheritance.
Initial core inheritance support will be through a psuedo-attribute [inherit]. Additional inheritance support may involve keywords.
Inheritance should be accomplished using Join-PipeScript.