diff --git a/src/cli/commands/manage.ts b/src/cli/commands/manage.ts index ae4967a..3b1f205 100644 --- a/src/cli/commands/manage.ts +++ b/src/cli/commands/manage.ts @@ -86,14 +86,19 @@ export async function listApps(options: ListAppsOptions) { const apps = allApps.filter((app) => !app.tool) const tools = allApps.filter((app) => app.tool) - if (apps.length > 0) { - console.log('apps:') + if (tools.length === 0) { + // No tools, just list apps without header/indent for (const app of apps) { - console.log(` ${STATE_ICONS[app.state] ?? '◯'} ${app.name}`) + console.log(`${STATE_ICONS[app.state] ?? '◯'} ${app.name}`) + } + } else { + if (apps.length > 0) { + console.log('apps:') + for (const app of apps) { + console.log(` ${STATE_ICONS[app.state] ?? '◯'} ${app.name}`) + } + console.log() } - } - if (tools.length > 0) { - if (apps.length > 0) console.log() console.log('tools:') for (const tool of tools) { console.log(` ${STATE_ICONS[tool.state] ?? '◯'} ${tool.name}`) diff --git a/src/server/tui.ts b/src/server/tui.ts index cda6a69..641e4c7 100644 --- a/src/server/tui.ts +++ b/src/server/tui.ts @@ -47,15 +47,16 @@ const formatStatus = (app: App): string => { } } -const formatAppLine = (app: App): string => { +const formatAppLine = (app: App, indent: boolean): string => { const status = formatStatus(app) const port = app.port ? `\x1b[90m:${app.port}\x1b[0m` : '' + const prefix = indent ? ' ' : '' if (_showEmoji) { const icon = app.icon ?? '📦' - return ` ${icon} ${app.name} ${status}${port}` + return `${prefix}${icon} ${app.name} ${status}${port}` } else { - return ` ${status} ${app.name}${port}` + return `${prefix}${status} ${app.name}${port}` } } @@ -86,18 +87,24 @@ function render() { const regularApps = _apps.filter(a => !a.tool) const tools = _apps.filter(a => a.tool) - if (regularApps.length > 0) { - lines.push('\x1b[1mApps\x1b[0m') + if (tools.length === 0) { + // No tools, just list apps without header/indent for (const app of regularApps) { - lines.push(formatAppLine(app)) + lines.push(formatAppLine(app, false)) } lines.push('') - } + } else { + if (regularApps.length > 0) { + lines.push('\x1b[1mApps\x1b[0m') + for (const app of regularApps) { + lines.push(formatAppLine(app, true)) + } + lines.push('') + } - if (tools.length > 0) { lines.push('\x1b[1mTools\x1b[0m') for (const app of tools) { - lines.push(formatAppLine(app)) + lines.push(formatAppLine(app, true)) } lines.push('') }