()
| 679 | } |
| 680 | |
| 681 | const main = async (): Promise<void> => { |
| 682 | const [action = 'menu', key] = process.argv.slice(2) |
| 683 | |
| 684 | if (action === 'recent') { |
| 685 | await printRecentCommands() |
| 686 | return |
| 687 | } |
| 688 | |
| 689 | if (action === 'run') { |
| 690 | if (!key) { |
| 691 | printAvailableTargets() |
| 692 | process.exitCode = 1 |
| 693 | return |
| 694 | } |
| 695 | |
| 696 | const command = getCommandByKey(key) |
| 697 | |
| 698 | if (!command) { |
| 699 | printAvailableTargets() |
| 700 | process.exitCode = 1 |
| 701 | return |
| 702 | } |
| 703 | |
| 704 | process.exitCode = await runShellCommand(command) |
| 705 | return |
| 706 | } |
| 707 | |
| 708 | const selectedCommand = await openMenu() |
| 709 | |
| 710 | if (!selectedCommand) { |
| 711 | return |
| 712 | } |
| 713 | |
| 714 | process.exitCode = await runShellCommand(selectedCommand) |
| 715 | } |
| 716 | |
| 717 | if (import.meta.main) { |
| 718 | await main() |
no test coverage detected