MCPcopy Index your code
hub / github.com/cameri/nostream / runTui

Function runTui

src/cli/tui/main.ts:10–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { tuiPrompts } from './prompts'
9
10export const runTui = async (): Promise<number> => {
11 const state = createState()
12 tuiPrompts.intro('Nostream Control Center')
13
14 while (state.running) {
15 const action = await tuiPrompts.select({
16 message: 'What would you like to do?',
17 options: [
18 { value: 'start', label: 'Start relay' },
19 { value: 'stop', label: 'Stop relay' },
20 { value: 'configure', label: 'Configure settings' },
21 { value: 'manage', label: 'Manage data (export/import)' },
22 { value: 'dev', label: 'Development tools' },
23 { value: 'info', label: 'View relay info' },
24 { value: 'exit', label: 'Exit' },
25 ],
26 })
27
28 if (tuiPrompts.isCancel(action) || action === 'exit') {
29 state.running = false
30 break
31 }
32
33 switch (action) {
34 case 'start':
35 await runStartMenu()
36 break
37 case 'stop':
38 await runStopMenu()
39 break
40 case 'configure':
41 await runConfigureMenu()
42 break
43 case 'manage':
44 await runManageMenu()
45 break
46 case 'dev':
47 await runDevMenu()
48 break
49 case 'info':
50 await runInfo({})
51 break
52 default:
53 tuiPrompts.cancel('Unknown action')
54 }
55 }
56
57 tuiPrompts.outro('Goodbye')
58 return 0
59}

Callers 1

index.tsFile · 0.90

Calls 7

createStateFunction · 0.90
runStartMenuFunction · 0.90
runStopMenuFunction · 0.90
runConfigureMenuFunction · 0.90
runManageMenuFunction · 0.90
runDevMenuFunction · 0.90
runInfoFunction · 0.90

Tested by

no test coverage detected