@heroku/heroku-cli-util 10.0.0-beta.0 → 10.0.0-beta.2
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/dist/ux/styled-object.js +1 -1
- package/dist/ux/table.d.ts +3 -11
- package/dist/ux/table.js +10 -2
- package/package.json +1 -1
package/dist/ux/styled-object.js
CHANGED
|
@@ -29,7 +29,7 @@ export function styledObject(obj, keys) {
|
|
|
29
29
|
const output = [];
|
|
30
30
|
const keyLengths = Object.keys(obj).map(key => key.toString().length);
|
|
31
31
|
const maxKeyLength = Math.max(...keyLengths) + 2;
|
|
32
|
-
const logKeyValue = (key, value) => `${color.
|
|
32
|
+
const logKeyValue = (key, value) => `${color.rgb(147, 112, 219)(key)}:` + ' '.repeat(maxKeyLength - key.length - 1) + prettyPrint(value);
|
|
33
33
|
for (const [key, value] of Object.entries(obj)) {
|
|
34
34
|
if (keys && !keys.includes(key))
|
|
35
35
|
continue;
|
package/dist/ux/table.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TableOptions } from '@oclif/table';
|
|
1
2
|
type Column<T extends Record<string, unknown>> = {
|
|
2
3
|
extended: boolean;
|
|
3
4
|
get(row: T): unknown;
|
|
@@ -7,16 +8,7 @@ type Column<T extends Record<string, unknown>> = {
|
|
|
7
8
|
type Columns<T extends Record<string, unknown>> = {
|
|
8
9
|
[key: string]: Partial<Column<T>>;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
-
columns?: string;
|
|
12
|
-
extended?: boolean;
|
|
13
|
-
filter?: string;
|
|
14
|
-
'no-header'?: boolean;
|
|
15
|
-
'no-truncate'?: boolean;
|
|
11
|
+
export declare function table<T extends Record<string, unknown>>(data: T[], columns: Columns<T>, options?: {
|
|
16
12
|
printLine?(s: unknown): void;
|
|
17
|
-
|
|
18
|
-
sort?: string;
|
|
19
|
-
title?: string;
|
|
20
|
-
};
|
|
21
|
-
export declare function table<T extends Record<string, unknown>>(data: T[], columns: Columns<T>, options?: Options): void;
|
|
13
|
+
} & Omit<TableOptions<T>, 'data'>): void;
|
|
22
14
|
export {};
|
package/dist/ux/table.js
CHANGED
|
@@ -6,10 +6,18 @@ export function table(data, columns, options) {
|
|
|
6
6
|
return key;
|
|
7
7
|
});
|
|
8
8
|
const d = data.map(row => Object.fromEntries(Object.entries(columns).map(([key, { get }]) => [key, get ? get(row) : row[key]])));
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
const { printLine, ...tableOptions } = options || {};
|
|
9
11
|
printTable({
|
|
10
|
-
|
|
12
|
+
...(tableOptions?.noStyle ? {} : {
|
|
13
|
+
borderColor: 'whiteBright',
|
|
14
|
+
borderStyle: 'headers-only-with-underline',
|
|
15
|
+
headerOptions: {
|
|
16
|
+
color: 'rgb(147, 112, 219)',
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
...tableOptions,
|
|
11
20
|
columns: cols,
|
|
12
21
|
data: d,
|
|
13
|
-
title: options?.title,
|
|
14
22
|
});
|
|
15
23
|
}
|