( name: string, )
| 798 | /** Classify command name as cmdlet, application, or unknown */ |
| 799 | // exported for testing |
| 800 | export function classifyCommandName( |
| 801 | name: string, |
| 802 | ): 'cmdlet' | 'application' | 'unknown' { |
| 803 | if (/^[A-Za-z]+-[A-Za-z][A-Za-z0-9_]*$/.test(name)) { |
| 804 | return 'cmdlet' |
| 805 | } |
| 806 | if (/[.\\/]/.test(name)) { |
| 807 | return 'application' |
| 808 | } |
| 809 | return 'unknown' |
| 810 | } |
| 811 | |
| 812 | /** Strip module prefix from command name (e.g. "Microsoft.PowerShell.Utility\\Invoke-Expression" -> "Invoke-Expression") */ |
| 813 | // exported for testing |
no outgoing calls
no test coverage detected