Skip to content

Commit 5381f68

Browse files
Update packages/blocks/terraform/src/lib/hcledit-cli.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1f73009 commit 5381f68

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/blocks/terraform/src/lib/hcledit-cli.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ function validateIdentifier(value: string, fieldName: string): void {
1717
}
1818
}
1919

20+
/**
21+
* Escapes a string for safe use as a shell argument.
22+
*
23+
* This function wraps the input value in single quotes and escapes any embedded single quotes
24+
* using the POSIX shell pattern: '\''. This is the standard technique for safely passing
25+
* arbitrary strings as arguments to POSIX-compliant shells.
26+
*
27+
* @param value - The string to escape for the shell.
28+
* @returns The shell-escaped string.
29+
*/
2030
function escapeShellArgument(value: string): string {
2131
return `'${value.replace(/'/g, `'\\''`)}'`;
2232
}

0 commit comments

Comments
 (0)