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