categories in toes list --all
This commit is contained in:
parent
a56af4ed47
commit
e4310bda6d
|
|
@ -79,17 +79,35 @@ interface ListAppsOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listApps(options: ListAppsOptions) {
|
export async function listApps(options: ListAppsOptions) {
|
||||||
const apps: App[] | undefined = await get('/api/apps')
|
const allApps: App[] | undefined = await get('/api/apps')
|
||||||
if (!apps) return
|
if (!allApps) return
|
||||||
|
|
||||||
const filtered = apps.filter((app) => {
|
if (options.all) {
|
||||||
if (options.all) return true
|
const apps = allApps.filter((app) => !app.tool)
|
||||||
if (options.tools) return app.tool
|
const tools = allApps.filter((app) => app.tool)
|
||||||
return !app.tool
|
|
||||||
})
|
|
||||||
|
|
||||||
for (const app of filtered) {
|
if (apps.length > 0) {
|
||||||
console.log(`${STATE_ICONS[app.state] ?? '◯'} ${app.name}`)
|
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
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const app of filtered) {
|
||||||
|
console.log(`${STATE_ICONS[app.state] ?? '◯'} ${app.name}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user