The platform-appropriate opener command + args for a URL.
(url: string, platform: string)
| 31 | |
| 32 | /** The platform-appropriate opener command + args for a URL. */ |
| 33 | function openerFor(url: string, platform: string): { cmd: string; args: string[] } { |
| 34 | if (platform === 'darwin') return { cmd: 'open', args: [url] }; |
| 35 | if (platform === 'win32') return { cmd: 'cmd', args: ['/c', 'start', '', url] }; |
| 36 | // linux / *bsd and the rest |
| 37 | return { cmd: 'xdg-open', args: [url] }; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Try to open `url` in the default browser. Resolves `true` if the opener was |