MCPcopy Create free account
hub / github.com/bombshell-dev/clack / renderDate

Function renderDate

packages/prompts/src/date.ts:139–155  ·  view source on GitHub ↗
(prompt: Omit<InstanceType<typeof DatePrompt>, 'prompt'>, state: State)

Source from the content-addressed store, hash-verified

137};
138
139function renderDate(prompt: Omit<InstanceType<typeof DatePrompt>, 'prompt'>, state: State): string {
140 const parts = prompt.segmentValues;
141 const cursor = prompt.segmentCursor;
142
143 if (state === 'submit' || state === 'cancel') {
144 return prompt.formattedValue;
145 }
146
147 const sep = styleText('gray', prompt.separator);
148 return prompt.segments
149 .map((seg, i) => {
150 const isActive = i === cursor.segmentIndex && !['submit', 'cancel'].includes(state);
151 const label = DEFAULT_LABELS[seg.type];
152 return renderSegment(parts[seg.type], { isActive, label });
153 })
154 .join(sep);
155}
156
157interface SegmentOptions {
158 isActive: boolean;

Callers 1

renderFunction · 0.85

Calls 1

renderSegmentFunction · 0.85

Tested by

no test coverage detected