toes list shows everything by default
This commit is contained in:
parent
cca93189e0
commit
d99f80cd0e
|
|
@ -80,9 +80,9 @@ Add `toes.tool` to your app's `package.json`:
|
|||
### CLI Flags
|
||||
|
||||
```bash
|
||||
toes list # Lists regular apps only (excludes tools)
|
||||
toes list # Lists all apps including tools
|
||||
toes list --tools # Lists tools only
|
||||
toes list --all # Lists all apps including tools
|
||||
toes list --apps # Lists regular apps only (excludes tools)
|
||||
```
|
||||
|
||||
### Tool vs App
|
||||
|
|
|
|||
|
|
@ -74,15 +74,24 @@ export async function infoApp(arg?: string) {
|
|||
}
|
||||
|
||||
interface ListAppsOptions {
|
||||
apps?: boolean
|
||||
tools?: boolean
|
||||
all?: boolean
|
||||
}
|
||||
|
||||
export async function listApps(options: ListAppsOptions) {
|
||||
const allApps: App[] | undefined = await get('/api/apps')
|
||||
if (!allApps) return
|
||||
|
||||
if (options.all) {
|
||||
if (options.apps || options.tools) {
|
||||
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}`)
|
||||
}
|
||||
} else {
|
||||
const apps = allApps.filter((app) => !app.tool)
|
||||
const tools = allApps.filter((app) => app.tool)
|
||||
|
||||
|
|
@ -104,15 +113,6 @@ export async function listApps(options: ListAppsOptions) {
|
|||
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}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ program
|
|||
.command('list')
|
||||
.description('List all apps')
|
||||
.option('-t, --tools', 'show only tools')
|
||||
.option('-a, --all', 'show all apps including tools')
|
||||
.option('-a, --apps', 'show only apps (exclude tools)')
|
||||
.action(listApps)
|
||||
|
||||
program
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user