MCPcopy Create free account
hub / github.com/ZingerLittleBee/ServerBee / main

Function main

scripts/make-menu.ts:681–715  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

679}
680
681const 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
717if (import.meta.main) {
718 await main()

Callers 1

make-menu.tsFile · 0.70

Calls 5

printRecentCommandsFunction · 0.85
printAvailableTargetsFunction · 0.85
getCommandByKeyFunction · 0.85
runShellCommandFunction · 0.85
openMenuFunction · 0.85

Tested by

no test coverage detected