8000 Enhance some cmdlets with Culture and Comparison parameters · Issue #9348 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Enhance some cmdlets with Culture and Comparison parameters #9348

@iSazonov

Description

@iSazonov

Approved proposal #9348 (comment)

Motivation

Currently some cmdlets process objects using only current culture. Sometime we have Culture parameter to use another culture and CaseSensitive parameter to switch from default case-INsensitive behavior to case-sensitive.

Using only current culture and case-insensitivity is not a justified restriction.
In management tasks, it is often justified to use culture invariant and ordinal/ordinal-ignorecase comparisons.

Using non-culture (especially ordinal) allows to significantly increase the performance of operations like processing large log files.

Summary of the new feature/enhancement

For follow cmdlets:

  • Compare-Object
  • Group-Object
  • Sort-Object
  • Select-Object
  • Select-String

implement:

  • add Culture parameter if absent
  • add Comparision (with values - Ordinal, OrdinalIgnoreCase, CurrentCulture, CurrentCultureIgnoreCase, InvariantCulture, InvariantCultureIgnoreCase and perhaps SimpleCaseFolding)
  • deprecate CaseSensitive parameter

Proposed technical implementation details

  • All this parameters is in ObjectCmdletBase class.
  • To deprecate CaseSensitive parameter add Parameter(DontShow = true).
  • Comparision parameter has priority over Culture parameter.
  • Defaults (stay like now) is CurrentCulture for Culture parameter and CurrentCultureIgnoreCase for Comparison parameter. Although we might consider OrdinalIgnoreCase.

Additional information

Come from #8180 discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Committee-ReviewedPS-Committee has reviewed this and made a decisionIssue-Enhancementthe issue is more of a feature request than a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0