mirror of
https://github.com/langgenius/dify.git
synced 2026-06-07 16:32:01 +08:00
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
import { DifyCommand } from '@/commands/_shared/dify-command'
|
|
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
|
import { Args, Flags } from '@/framework/flags'
|
|
import { formatted, OutputFormat } from '@/framework/output'
|
|
import { runDescribeApp } from './run'
|
|
|
|
export default class DescribeApp extends DifyCommand {
|
|
static override description = 'Describe a single app (kubectl-describe-style)'
|
|
|
|
static override examples = [
|
|
'<%= config.bin %> describe app app-1',
|
|
'<%= config.bin %> describe app app-1 -o json',
|
|
'<%= config.bin %> describe app app-1 --refresh',
|
|
]
|
|
|
|
static override args = {
|
|
id: Args.string({ description: 'app id', required: true }),
|
|
}
|
|
|
|
static override flags = {
|
|
'workspace': Flags.string({ description: 'workspace id (overrides DIFY_WORKSPACE_ID and stored default)' }),
|
|
'http-retry': httpRetryFlag,
|
|
'output': Flags.outputFormat({ options: [OutputFormat.JSON, OutputFormat.YAML, OutputFormat.TEXT], default: '' }),
|
|
'refresh': Flags.boolean({ description: 'bypass app-info cache and fetch fresh', default: false }),
|
|
}
|
|
|
|
async run(argv: string[]) {
|
|
const { args, flags } = this.parse(DescribeApp, argv)
|
|
const format = flags.output
|
|
const ctx = await this.authedCtx({ retryFlag: flags['http-retry'], withCache: true, format })
|
|
return formatted({
|
|
format,
|
|
data: await runDescribeApp(
|
|
{ appId: args.id, workspace: flags.workspace, format, refresh: flags.refresh },
|
|
{ active: ctx.active, http: ctx.http, host: ctx.host, io: ctx.io, cache: ctx.cache },
|
|
),
|
|
})
|
|
}
|
|
}
|