Skip to content

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Aug 7, 2025

PR Summary

Add endsWith(), startsWith(), utcNow(), and uniqueString() functions. Note that utcNow() supports a subset of the .NET datetime formatting strings.

Also refactored how functions get registered with DSC so that it's from a vector and takes the name from the metadata so no risk of them being out of sync.

PR Context

Part of #976

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds four new string and date functions to the DSC library: endsWith, startsWith, utcNow, and uniqueString. These functions enhance the DSC template expression capabilities with string manipulation and utility operations.

  • Implements string prefix/suffix checking with startsWith and endsWith functions
  • Adds utcNow function for date formatting with .NET format string conversion support
  • Provides uniqueString function for generating deterministic hashes from concatenated inputs
  • Refactors function registration from individual insertions to a vector-based approach for better maintainability

Reviewed Changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
dsc_lib/src/functions/ends_with.rs New function to check if a string ends with a specified suffix
dsc_lib/src/functions/starts_with.rs New function to check if a string starts with a specified prefix
dsc_lib/src/functions/utc_now.rs New function to get current UTC time with optional .NET format string support
dsc_lib/src/functions/unique_string.rs New function to generate deterministic unique strings from input arguments
dsc_lib/src/functions/mod.rs Refactored function registration and added new function imports
dsc_lib/src/configure/context.rs Added parameter default processing flag to context
dsc_lib/src/configure/mod.rs Updated parameter default processing to use context flag
dsc_lib/locales/en-us.toml Added localization strings for new functions
dsc_lib/Cargo.toml Added dependencies for new functions (base32, murmurhash64)
dsc/tests/dsc_functions.tests.ps1 Added comprehensive tests for new functions

@SteveL-MSFT SteveL-MSFT requested a review from tgauth August 7, 2025 03:44
Copy link
Collaborator

@tgauth tgauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Aug 7, 2025
Merged via the queue into PowerShell:main with commit 18fd542 Aug 7, 2025
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the functions branch August 7, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants