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

Function activeStyle

packages/prompts/src/progress-bar.ts:35–48  ·  view source on GitHub ↗
(state: State)

Source from the content-addressed store, hash-verified

33 const size = Math.max(1, userSize);
34
35 const activeStyle = (state: State) => {
36 switch (state) {
37 case 'initial':
38 case 'active':
39 return (text: string) => styleText('magenta', text);
40 case 'error':
41 case 'cancel':
42 return (text: string) => styleText('red', text);
43 case 'submit':
44 return (text: string) => styleText('green', text);
45 default:
46 return (text: string) => styleText('magenta', text);
47 }
48 };
49 const drawProgress = (state: State, msg: string) => {
50 const active = Math.floor((value / max) * size);
51 return `${activeStyle(state)(S_PROGRESS_CHAR[style].repeat(active))}${styleText('dim', S_PROGRESS_CHAR[style].repeat(size - active))} ${msg}`;

Callers 1

drawProgressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected