MCPcopy
hub / github.com/bombshell-dev/clack / _stop

Function _stop

packages/prompts/src/spinner.ts:173–194  ·  view source on GitHub ↗
(msg = '', code = 0, silent: boolean = false)

Source from the content-addressed store, hash-verified

171 };
172
173 const _stop = (msg = '', code = 0, silent: boolean = false): void => {
174 if (!isSpinnerActive) return;
175 isSpinnerActive = false;
176 clearInterval(loop);
177 clearPrevMessage();
178 const step =
179 code === 0
180 ? styleText('green', S_STEP_SUBMIT)
181 : code === 1
182 ? styleText('red', S_STEP_CANCEL)
183 : styleText('red', S_STEP_ERROR);
184 _message = msg ?? _message;
185 if (!silent) {
186 if (indicator === 'timer') {
187 output.write(`${step} ${_message} ${formatTimer(_origin)}\n`);
188 } else {
189 output.write(`${step} ${_message}\n`);
190 }
191 }
192 clearHooks();
193 unblock();
194 };
195
196 const stop = (msg = ''): void => _stop(msg, 0);
197 const cancel = (msg = ''): void => _stop(msg, 1);

Callers 5

handleExitFunction · 0.85
stopFunction · 0.85
cancelFunction · 0.85
errorFunction · 0.85
clearFunction · 0.85

Calls 3

clearPrevMessageFunction · 0.85
formatTimerFunction · 0.85
clearHooksFunction · 0.85

Tested by

no test coverage detected