(name: string)
| 812 | /** Strip module prefix from command name (e.g. "Microsoft.PowerShell.Utility\\Invoke-Expression" -> "Invoke-Expression") */ |
| 813 | // exported for testing |
| 814 | export function stripModulePrefix(name: string): string { |
| 815 | const idx = name.lastIndexOf('\\') |
| 816 | if (idx < 0) return name |
| 817 | // Don't strip file paths: drive letters (C:\...), UNC paths (\\server\...), or relative paths (.\, ..\) |
| 818 | if ( |
| 819 | /^[A-Za-z]:/.test(name) || |
| 820 | name.startsWith('\\\\') || |
| 821 | name.startsWith('.\\') || |
| 822 | name.startsWith('..\\') |
| 823 | ) |
| 824 | return name |
| 825 | return name.substring(idx + 1) |
| 826 | } |
| 827 | |
| 828 | /** Transform a raw CommandAst pipeline element into ParsedCommandElement */ |
| 829 | // exported for testing |
no outgoing calls
no test coverage detected