Skip to content
Prev Previous commit
Merge remote-tracking branch 'upstream/main' into collections
  • Loading branch information
adamsitnik committed Dec 15, 2022
commit 9d461f4572b168d75628403a725bf0c96d181797
35 changes: 0 additions & 35 deletions src/System.CommandLine/Option.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,6 @@ public ArgumentArity Arity

internal bool DisallowBinding { get; init; }

/// <inheritdoc />
public override string Name
{
set
{
if (!HasAlias(value))
{
_name = null;
RemoveAlias(DefaultName);
}

base.Name = value;
}
}

/// <summary>
/// Validators that will be called when the option is matched by the parser.
/// </summary>
Expand All @@ -106,26 +91,6 @@ public override string Name
/// </summary>
public List<Func<CompletionContext, IEnumerable<CompletionItem>>> CompletionSources => Argument.CompletionSources;

/// <summary>
/// Indicates whether a given alias exists on the option, regardless of its prefix.
/// </summary>
/// <param name="alias">The alias, which can include a prefix.</param>
/// <returns><see langword="true"/> if the alias exists; otherwise, <see langword="false"/>.</returns>
public bool HasAliasIgnoringPrefix(string alias)
{
ReadOnlySpan<char> rawAlias = alias.AsSpan(alias.GetPrefixLength());

foreach (string existingAlias in _aliases)
{
if (MemoryExtensions.Equals(existingAlias.AsSpan(existingAlias.GetPrefixLength()), rawAlias, StringComparison.CurrentCulture))
{
return true;
}
}

return false;
}

/// <summary>
/// Gets a value that indicates whether multiple argument tokens are allowed for each option identifier token.
/// </summary>
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.