(source: MarketplaceSource)
| 508 | * Format a MarketplaceSource for display in error messages |
| 509 | */ |
| 510 | export function formatSourceForDisplay(source: MarketplaceSource): string { |
| 511 | switch (source.source) { |
| 512 | case 'github': |
| 513 | return `github:${source.repo}${source.ref ? `@${source.ref}` : ''}` |
| 514 | case 'url': |
| 515 | return source.url |
| 516 | case 'git': |
| 517 | return `git:${source.url}${source.ref ? `@${source.ref}` : ''}` |
| 518 | case 'npm': |
| 519 | return `npm:${source.package}` |
| 520 | case 'file': |
| 521 | return `file:${source.path}` |
| 522 | case 'directory': |
| 523 | return `dir:${source.path}` |
| 524 | case 'hostPattern': |
| 525 | return `hostPattern:${source.hostPattern}` |
| 526 | case 'pathPattern': |
| 527 | return `pathPattern:${source.pathPattern}` |
| 528 | case 'settings': |
| 529 | return `settings:${source.name} (${source.plugins.length} ${plural(source.plugins.length, 'plugin')})` |
| 530 | default: |
| 531 | return 'unknown source' |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * Reasons why no marketplaces are available in the Discover screen |
no test coverage detected