/// <summary> /// Sets the variables for this cmdlet. The results of the command and the command string are also set. /// If the -Value of the command string is a function, the function is appended to the command string. /// </summary> /// <param name="cmdlet">The WritableByname cmdlet</param> /// <param name="commandResults">The results of invoking the PowerShell command for the WritableByname cmdlet</param> protected WritableBynameCreatorBaseOperation(WritableByname cmdlet, IEnumerable <PSObject> commandResults) : base(commandResults) { AliasCmdlet = cmdlet; var sb = new StringBuilder(); if (GetAliasValueType() is FunctionValueType ft) { sb.Append($"function {AliasCmdlet.Value} {{ {ft.ScriptBlock} }}{Environment.NewLine}"); } PsCommandAsString = sb.Append(cmdlet).ToString(); }
/// <inheritdoc cref="WritableBynameCreatorBaseOperation"/> internal NewBynameCreatorOperation(WritableByname cmdlet, IEnumerable <PSObject> commandResults) : base(cmdlet, commandResults) { }