MCPcopy Index your code
hub / github.com/anomalyco/opencode / questionPick

Function questionPick

packages/opencode/src/cli/cmd/run/question.shared.ts:157–193  ·  view source on GitHub ↗
(
  state: QuestionBodyState,
  request: QuestionRequest,
  answer: string,
  custom = false,
)

Source from the content-addressed store, hash-verified

155}
156
157function questionPick(
158 state: QuestionBodyState,
159 request: QuestionRequest,
160 answer: string,
161 custom = false,
162): QuestionStep {
163 const answers = [...state.answers]
164 answers[state.tab] = [answer]
165 let next: QuestionBodyState = {
166 ...state,
167 answers,
168 editing: false,
169 }
170
171 if (custom) {
172 const list = [...state.custom]
173 list[state.tab] = answer
174 next = {
175 ...next,
176 custom: list,
177 }
178 }
179
180 if (questionSingle(request)) {
181 return {
182 state: next,
183 reply: {
184 requestID: request.id,
185 answers: [[answer]],
186 },
187 }
188 }
189
190 return {
191 state: questionSetTab(next, state.tab + 1),
192 }
193}
194
195function questionToggle(state: QuestionBodyState, answer: string): QuestionBodyState {
196 const list = [...(state.answers[state.tab] ?? [])]

Callers 2

questionSelectFunction · 0.85
questionSaveFunction · 0.85

Calls 2

questionSingleFunction · 0.85
questionSetTabFunction · 0.85

Tested by

no test coverage detected