pickem 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/display/format.d.ts.map +1 -1
- package/display/format.js +22 -7
- package/display/format.js.map +1 -1
- package/package.json +2 -3
package/LICENSE
CHANGED
package/display/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/display/format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/display/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEvD,KAAK,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;AAsDjE,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED,wBAAgB,eAAe,CAAC,CAAC,EAC/B,OAAO,GAAE,aAAkB,GAC1B,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,KAAK,MAAM,CAoBzD"}
|
package/display/format.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
const ANSI = {
|
|
2
|
+
reset: '\x1b[0m',
|
|
3
|
+
dim: '\x1b[2m',
|
|
4
|
+
red: '\x1b[31m',
|
|
5
|
+
green: '\x1b[32m',
|
|
6
|
+
yellow: '\x1b[33m',
|
|
7
|
+
blue: '\x1b[34m',
|
|
8
|
+
magenta: '\x1b[35m',
|
|
9
|
+
gray: '\x1b[90m',
|
|
10
|
+
};
|
|
2
11
|
const DEFAULT_BADGE_COLORS = {
|
|
3
12
|
npm: 'red',
|
|
4
13
|
script: 'blue',
|
|
@@ -6,22 +15,28 @@ const DEFAULT_BADGE_COLORS = {
|
|
|
6
15
|
workflow: 'magenta',
|
|
7
16
|
tool: 'yellow',
|
|
8
17
|
};
|
|
18
|
+
function colorize(text, color) {
|
|
19
|
+
const code = ANSI[color] ?? ANSI.gray;
|
|
20
|
+
return `${code}${text}${ANSI.reset}`;
|
|
21
|
+
}
|
|
22
|
+
function dim(text) {
|
|
23
|
+
return `${ANSI.dim}${text}${ANSI.reset}`;
|
|
24
|
+
}
|
|
9
25
|
function renderBadge(group, style, colors) {
|
|
10
26
|
if (typeof style === 'function') {
|
|
11
27
|
return style(group);
|
|
12
28
|
}
|
|
13
|
-
const
|
|
14
|
-
const colorFn = chalk[colorName] ?? chalk.gray;
|
|
29
|
+
const color = colors[group] ?? 'gray';
|
|
15
30
|
if (style === 'dot') {
|
|
16
|
-
return
|
|
31
|
+
return colorize('●', color) + ' ';
|
|
17
32
|
}
|
|
18
33
|
// bracket (default)
|
|
19
|
-
return
|
|
34
|
+
return colorize(`[${group}]`, color) + ' ';
|
|
20
35
|
}
|
|
21
36
|
function renderUsageCount(count) {
|
|
22
37
|
if (count === 0)
|
|
23
38
|
return '';
|
|
24
|
-
return
|
|
39
|
+
return dim(` (${count})`);
|
|
25
40
|
}
|
|
26
41
|
export function createFormatter(options = {}) {
|
|
27
42
|
const style = options.badgeStyle ?? 'bracket';
|
|
@@ -34,7 +49,7 @@ export function createFormatter(options = {}) {
|
|
|
34
49
|
result += item.label;
|
|
35
50
|
result += renderUsageCount(stats?.count ?? 0);
|
|
36
51
|
if (item.description) {
|
|
37
|
-
result +=
|
|
52
|
+
result += dim(` — ${item.description}`);
|
|
38
53
|
}
|
|
39
54
|
return result;
|
|
40
55
|
};
|
package/display/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/display/format.ts"],"names":[],"mappings":"
|
|
1
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;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAC1B,OAAO,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,CAAA;AAC3B,CAAC;AAOD,MAAM,UAAU,eAAe,CAC7B,UAAyB,EAAE;IAE3B,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,SAAS,CAAA;IAC7C,MAAM,MAAM,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAA;IAElE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,MAAM,GAAG,EAAE,CAAA;QAEf,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QAClD,CAAC;QAED,MAAM,IAAI,IAAI,CAAC,KAAK,CAAA;QACpB,MAAM,IAAI,gBAAgB,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,CAAA;QAE7C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pickem",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Usage-sorted searchable autocomplete for CLI tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"node": ">=18"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@inquirer/prompts": "^7.0.0"
|
|
29
|
-
"chalk": "^5.3.0"
|
|
28
|
+
"@inquirer/prompts": "^7.0.0"
|
|
30
29
|
}
|
|
31
30
|
}
|