MCPcopy Create free account
hub / github.com/langgenius/dify / sniffOutputFormat

Function sniffOutputFormat

cli/src/framework/run.ts:118–138  ·  view source on GitHub ↗
(argv: readonly string[])

Source from the content-addressed store, hash-verified

116}
117
118export function sniffOutputFormat(argv: readonly string[]): string {
119 for (let i = 0; i < argv.length; i++) {
120 const t = argv[i]
121 if (t === undefined)
122 continue
123 if (t === '--')
124 return ''
125
126 if (t === '--output' || t === '-o') {
127 const next = argv[i + 1]
128 if (next !== undefined && !next.startsWith('-'))
129 return next
130 continue
131 }
132 if (t.startsWith('--output='))
133 return t.slice('--output='.length)
134 if (t.startsWith('-o='))
135 return t.slice('-o='.length)
136 }
137 return ''
138}
139
140function isStructuredFormat(format: string): boolean {
141 return format === 'json' || format === 'yaml'

Callers 2

run.test.tsFile · 0.90
runFunction · 0.85

Calls 2

startsWithMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected