Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

801 B
Raw Blame
import { expect, it } from 'vite-plus/test'
import { Context } from '@/kernel/context'
import { argv } from '@/plugins/argv'
import { globalFlags } from './index'

async function parse(tokens: readonly string[]) {
  return new Context([[argv, tokens]]).get(globalFlags)
}

it('takes --verbose anywhere, hands the command the rest, and leaves -- alone', async () => {
  expect(await parse(['--verbose', 'call', 'a.b', '--input', '{}'])).toEqual({
    flags: { verbose: true, json: false },
    rest: ['call', 'a.b', '--input', '{}'],
  })
  expect(await parse(['call', 'a.b', '--', '--verbose'])).toEqual({
    flags: { verbose: false, json: false },
    rest: ['call', 'a.b', '--', '--verbose'],
  })
  await expect(parse(['--verbose=maybe'])).rejects.toMatchObject({ code: 'usage_invalid_flag' })
})