| 634 | return s.plugins.errors; |
| 635 | } |
| 636 | function getInitialViewState(parsedCommand: ParsedCommand): ViewState { |
| 637 | switch (parsedCommand.type) { |
| 638 | case 'help': |
| 639 | return { |
| 640 | type: 'help' |
| 641 | }; |
| 642 | case 'validate': |
| 643 | return { |
| 644 | type: 'validate', |
| 645 | path: parsedCommand.path |
| 646 | }; |
| 647 | case 'install': |
| 648 | if (parsedCommand.marketplace) { |
| 649 | return { |
| 650 | type: 'browse-marketplace', |
| 651 | targetMarketplace: parsedCommand.marketplace, |
| 652 | targetPlugin: parsedCommand.plugin |
| 653 | }; |
| 654 | } |
| 655 | if (parsedCommand.plugin) { |
| 656 | return { |
| 657 | type: 'discover-plugins', |
| 658 | targetPlugin: parsedCommand.plugin |
| 659 | }; |
| 660 | } |
| 661 | return { |
| 662 | type: 'discover-plugins' |
| 663 | }; |
| 664 | case 'manage': |
| 665 | return { |
| 666 | type: 'manage-plugins' |
| 667 | }; |
| 668 | case 'uninstall': |
| 669 | return { |
| 670 | type: 'manage-plugins', |
| 671 | targetPlugin: parsedCommand.plugin, |
| 672 | action: 'uninstall' |
| 673 | }; |
| 674 | case 'enable': |
| 675 | return { |
| 676 | type: 'manage-plugins', |
| 677 | targetPlugin: parsedCommand.plugin, |
| 678 | action: 'enable' |
| 679 | }; |
| 680 | case 'disable': |
| 681 | return { |
| 682 | type: 'manage-plugins', |
| 683 | targetPlugin: parsedCommand.plugin, |
| 684 | action: 'disable' |
| 685 | }; |
| 686 | case 'marketplace': |
| 687 | if (parsedCommand.action === 'list') { |
| 688 | return { |
| 689 | type: 'marketplace-list' |
| 690 | }; |
| 691 | } |
| 692 | if (parsedCommand.action === 'add') { |
| 693 | return { |