categories in toes list --all

This commit is contained in:
Chris Wanstrath 2026-01-30 22:25:20 -08:00
parent a56af4ed47
commit e4310bda6d

View File

@ -79,11 +79,28 @@ interface ListAppsOptions {
}
export async function listApps(options: ListAppsOptions) {
const apps: App[] | undefined = await get('/api/apps')
if (!apps) return
const allApps: App[] | undefined = await get('/api/apps')
if (!allApps) return
const filtered = apps.filter((app) => {
if (options.all) return true
if (options.all) {
const apps = allApps.filter((app) => !app.tool)
const tools = allApps.filter((app) => app.tool)
if (apps.length > 0) {
console.log('apps:')
for (const app of apps) {
console.log(` ${STATE_ICONS[app.state] ?? '◯'} ${app.name}`)
}
}
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}`)
}
}
} else {
const filtered = allApps.filter((app) => {
if (options.tools) return app.tool
return !app.tool
})
@ -91,6 +108,7 @@ export async function listApps(options: ListAppsOptions) {
for (const app of filtered) {
console.log(`${STATE_ICONS[app.state] ?? '◯'} ${app.name}`)
}
}
}
interface NewAppOptions {