@oclif/table 0.1.0 → 0.1.1

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/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { makeTable, makeTables } from './table.js';
2
- export type { TableProps } from './types.js';
1
+ export { printTable, printTables } from './table.js';
2
+ export type { ScalarDict, TableProps } from './types.js';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export { makeTable, makeTables } from './table.js';
1
+ export { printTable, printTables } from './table.js';
package/lib/table.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare function Skeleton(props: React.PropsWithChildren & {
19
19
  * Renders a table with the given data.
20
20
  * @param options see {@link TableProps}
21
21
  */
22
- export declare function makeTable<T extends ScalarDict>(options: TableProps<T>): void;
23
- export declare function makeTables<T extends ScalarDict[]>(tables: {
22
+ export declare function printTable<T extends ScalarDict>(options: TableProps<T>): void;
23
+ export declare function printTables<T extends ScalarDict[]>(tables: {
24
24
  [P in keyof T]: TableProps<T[P]>;
25
25
  }, options?: Omit<ContainerProps, 'children'>): void;
package/lib/table.js CHANGED
@@ -217,14 +217,14 @@ export function Skeleton(props) {
217
217
  * Renders a table with the given data.
218
218
  * @param options see {@link TableProps}
219
219
  */
220
- export function makeTable(options) {
220
+ export function printTable(options) {
221
221
  const instance = render(React.createElement(Table, { ...options }));
222
222
  instance.unmount();
223
223
  }
224
224
  function Container(props) {
225
225
  return (React.createElement(Box, { flexWrap: "wrap", flexDirection: props.direction ?? 'row', ...props }, props.children));
226
226
  }
227
- export function makeTables(tables, options) {
227
+ export function printTables(tables, options) {
228
228
  const leftMargin = options?.marginLeft ?? options?.margin ?? 0;
229
229
  const rightMargin = options?.marginRight ?? options?.margin ?? 0;
230
230
  const columns = process.stdout.columns - (leftMargin + rightMargin);
package/lib/types.d.ts CHANGED
@@ -123,16 +123,16 @@ export type TableProps<T extends ScalarDict> = {
123
123
  * ]
124
124
  *
125
125
  * // sort the name column in ascending order
126
- * makeTable({data, sort: {name: 'asc'}})
126
+ * printTable({data, sort: {name: 'asc'}})
127
127
  *
128
128
  * // sort the name column in descending order
129
- * makeTable({data, sort: {name: 'desc'}})
129
+ * printTable({data, sort: {name: 'desc'}})
130
130
  *
131
131
  * // sort by name in ascending order and age in descending order
132
- * makeTable({data, sort: {name: 'asc', age: 'desc'}})
132
+ * printTable({data, sort: {name: 'asc', age: 'desc'}})
133
133
  *
134
134
  * // sort by name in ascending order and age in descending order using a custom sort function
135
- * makeTable({data, sort: {name: 'asc', age: (a, b) => b - a}})
135
+ * printTable({data, sort: {name: 'asc', age: (a, b) => b - a}})
136
136
  * ```
137
137
  */
138
138
  sort?: Sort<T>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/table",
3
3
  "description": "Display table in terminal",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/multi-stage-output/issues",
7
7
  "dependencies": {