feat(cli-progress): update creation options (#41263)

- `align` added in 2.1
- `hideCursor` update allowed type definition changing the property
documentation to reflect change
- tests updated

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-01-02 19:35:50 +01:00 committed by Ryan Cavanaugh
parent f85a085e48
commit 3d035b0a86
2 changed files with 30 additions and 2 deletions

View File

@ -107,3 +107,26 @@ function test6() {
multiBar.stop();
}
// Options
function test7() {
// defaults
let singleBar = new progress.SingleBar({});
// align
singleBar = new progress.SingleBar({
align: 'left',
});
singleBar = new progress.SingleBar({
align: 'center',
});
singleBar = new progress.SingleBar({
align: 'right',
});
// hideCursor
singleBar = new progress.SingleBar({
hideCursor: true,
});
singleBar = new progress.SingleBar({
hideCursor: null,
});
}

View File

@ -41,6 +41,8 @@ export interface Options {
/** the length of the progress bar in chars (default: 40) */
barsize?: number;
/** position of the progress bar - 'left' (default), 'right' or 'center */
align?: 'left' | 'right' | 'center';
/** character to use as "complete" indicator in the bar (default: "=") */
barCompleteString?: string;
@ -54,8 +56,11 @@ export interface Options {
/** character to use as "incomplete" indicator in the bar (default: "-") */
barIncompleteChar?: string;
/** hide the cursor during progress operation; restored on complete (default: false) */
hideCursor?: boolean;
/**
* hide the cursor during progress operation; restored on complete (default: false)
* - pass `null` to keep terminal settings
*/
hideCursor?: boolean | null;
/** number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10) */
etaBuffer?: number;