MCPcopy Create free account
hub / github.com/bytespider/Meross / bar

Function bar

packages/cli/src/cli.ts:25–39  ·  view source on GitHub ↗
(percent: number, width: number)

Source from the content-addressed store, hash-verified

23 * Draws a coloured bar of specified width
24 */
25export const bar = (percent: number, width: number): string => {
26 const partials = ['▏', '▎', '▍', '▌', '▋', '▊', '▉'];
27 let ticks = percent * width;
28 if (ticks < 0) {
29 ticks = 0;
30 }
31 let filled = Math.floor(ticks);
32 let open = width - filled;
33
34 return (
35 (percentToColor(percent) + '▉').repeat(filled) +
36 partials[Math.floor((ticks - filled) * partials.length)] +
37 ' '.repeat(open)
38 );
39};
40
41/**
42 * Draws a spinner and a message that is updated on success or failure

Callers 1

printWifiListTableFunction · 0.85

Calls 1

percentToColorFunction · 0.85

Tested by

no test coverage detected