-
Notifications
You must be signed in to change notification settings - Fork 53
CHANGE: @W-20005455@: Upgrade oclif and core salesforce dependencies to latest #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import {Ux, Spinner} from '@salesforce/sf-plugins-core'; | ||
| import {TableOptions} from '@oclif/table'; | ||
| import {Spinner} from '@salesforce/sf-plugins-core'; | ||
|
|
||
| /** | ||
| * Interface for objects that display output information to users. E.g., a class that prints to the CLI would implement | ||
|
|
@@ -31,7 +32,7 @@ export interface Display { | |
| /** | ||
| * Output table to stdout only if the "--json" flag is not present. | ||
| */ | ||
| displayTable<R extends Ux.Table.Data>(data: R[], columns: Ux.Table.Columns<R>): void; | ||
| displayTable<R extends Record<string, unknown>>(options: TableOptions<R>): void; | ||
|
|
||
| /** | ||
| * Prompt the user to confirm that the described action should be carried out, and block until they respond (or a timeout | ||
|
|
@@ -73,12 +74,28 @@ export class UxDisplay implements Display { | |
| this.displayable.log(message); | ||
| } | ||
|
|
||
| public displayTable<R extends Ux.Table.Data>(data: R[], columns: Ux.Table.Columns<R>): void { | ||
| this.displayable.table(data, columns); | ||
| public displayTable<R extends Record<string, unknown>>(options: TableOptions<R>): void { | ||
| // Currently oclif's table options do not allow us to set the width of the table larger than the user's current | ||
| // terminal width. This means if the user's terminal width is small then we will table cells with "truncate" by | ||
| // default or "wrap" depending on the passed in 'overflow' value in the table options. To work around this | ||
| // limitation, we temporarily set the OCLIF_TABLE_COLUMN_OVERRIDE environment variable so that the user's | ||
| // terminal width is ignored so that no truncating or wrapping occurs in order to maintain our original table | ||
| // view behavior (prior to when we upgraded oclif). | ||
| const oldTableColumnOverrideValue = process.env.OCLIF_TABLE_COLUMN_OVERRIDE; | ||
|
|
||
| // If we use too large a number (like 99999), then we can get out of memory issues. Using 3000 seems to the best | ||
| // number that fits everything without causing memory issues. And if there is more than 3000 characters then at | ||
| // that point we are fine wrapping or truncating | ||
| process.env.OCLIF_TABLE_COLUMN_OVERRIDE = '3000'; | ||
| try { | ||
| this.displayable.table(options); | ||
| } finally { | ||
| process.env.OCLIF_TABLE_COLUMN_OVERRIDE = oldTableColumnOverrideValue; | ||
| } | ||
| } | ||
|
|
||
| public confirm(message: string): Promise<boolean> { | ||
| return this.displayable.confirm(message); | ||
| return this.displayable.confirm({message}); | ||
| } | ||
|
|
||
| public spinnerStart(msg: string, status?: string): void { | ||
|
|
@@ -111,8 +128,8 @@ export interface Displayable { | |
| log(message?: string): void; | ||
|
|
||
| // Prompt the user to confirm that the described action should be performed. [Implemented by SfCommand] | ||
| confirm(message: string): Promise<boolean>; | ||
| confirm(promptInputs: {message: string}): Promise<boolean>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting new syntax - I wonder what else has become available with this upgrade 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah there are more options - but I didn't want to pull in all the types if we didn't have to. So I just did minimal update needed for now. |
||
|
|
||
| // Output table to stdout only when "--json" flag is not present. [Implemented by SfCommand] | ||
| table<R extends Ux.Table.Data>(data: R[], columns: Ux.Table.Columns<R>, options?: Ux.Table.Options): void; | ||
| table<R extends Record<string, unknown>>(options: TableOptions<R>): void; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯