// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Management.Automation; namespace Microsoft.PowerShell.Commands { /// /// The base class for the */content commands that also take /// a passthrough parameter. /// public class PassThroughContentCommandBase : ContentCommandBase { #region Parameters /// /// Gets or sets the passthrough parameter to the command. /// [Parameter] public SwitchParameter PassThru { get { return _passThrough; } set { _passThrough = value; } } /// /// Determines if the provider for the specified path supports ShouldProcess. /// /// protected override bool ProviderSupportsShouldProcess { get { return base.DoesProviderSupportShouldProcess(base.Path); } } #endregion Parameters #region parameter data /// /// Determines if the content returned from the provider should /// be passed through to the pipeline. /// private bool _passThrough; #endregion parameter data #region protected members /// /// Initializes a CmdletProviderContext instance to the current context of /// the command. /// /// /// A CmdletProviderContext instance initialized to the context of the current /// command. /// internal CmdletProviderContext GetCurrentContext() { CmdletProviderContext currentCommandContext = CmdletProviderContext; currentCommandContext.PassThru = PassThru; return currentCommandContext; } #endregion protected members } }