PackagePublishCmdlet.cs
using System;
using System.Management.Automation; namespace AcuPackageTools { [Cmdlet(VerbsLifecycle.Invoke, "PackagePublish")] public class PackagePublishCmdlet : PSCmdlet { [Parameter( Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] [Alias("pn")] public string PackageName { get; set; } [Parameter( Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] [Alias("pfn")] public string PackageFileName { get; set; } [Parameter( Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] [Alias("url")] public string Url { get; set; } [Parameter( Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] [Alias("u")] public string Username { get; set; } [Parameter( Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] [Alias("p")] public string Password { get; set; } // This method gets called once for each cmdlet in the pipeline when the pipeline starts executing protected override void BeginProcessing() { WriteVerbose("Begin!"); } // This method will be called for each input received from the pipeline to this cmdlet; if no input is received, this method is not called protected override void ProcessRecord() { PackagePublisher.PublishCustomizationPackage(PackageName, PackageFileName, Url, Username, Password); } // This method will be called once at the end of pipeline execution; if no input is received, this method is not called protected override void EndProcessing() { WriteVerbose("End!"); } } } |