pixl-cli 1.0.20 → 1.0.21
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/README.md +10 -1
- package/cli.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
+ [TTY Detection](#tty-detection)
|
|
13
13
|
+ [Other Tools](#other-tools)
|
|
14
14
|
* [Command-Line Arguments](#command-line-arguments)
|
|
15
|
+
+ [Argument Aliases](#argument-aliases)
|
|
15
16
|
+ [Verbose Mode](#verbose-mode)
|
|
16
17
|
+ [Quiet Mode](#quiet-mode)
|
|
17
18
|
* [Prompting The User](#prompting-the-user)
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
+ [Configuration](#configuration)
|
|
25
26
|
+ [Temporarily Erasing The Bar](#temporarily-erasing-the-bar)
|
|
26
27
|
+ [Customizing the Look](#customizing-the-look)
|
|
28
|
+
+ [Indeterminite Progress](#indeterminite-progress)
|
|
27
29
|
+ [Changing Color Styles](#changing-color-styles)
|
|
28
30
|
+ [Automatic Width](#automatic-width)
|
|
29
31
|
+ [Keep progress bar visible](#keep-progress-bar-visible)
|
|
@@ -507,6 +509,7 @@ Calls to `cli.progress.start()` and `cli.progress.update()` accept an object con
|
|
|
507
509
|
| `filling` | An array of characters to use as the bar chunk filling progression. |
|
|
508
510
|
| `filled` | A single character representing one filled bar chunk, defaults to "⣿". |
|
|
509
511
|
| `styles` | A set of color styles to use (see [Changing Color Styles](#changing-color-styles) below). |
|
|
512
|
+
| `pct` | Show percentage (defaults to `true`). |
|
|
510
513
|
|
|
511
514
|
If you call `cli.progress.update()` and pass in a number, the library assumes you are just updating the `amount`. However, if you pass in an object, all the specified properties are updated.
|
|
512
515
|
|
|
@@ -554,6 +557,12 @@ cli.progress.start({
|
|
|
554
557
|
});
|
|
555
558
|
```
|
|
556
559
|
|
|
560
|
+
### Indeterminite Progress
|
|
561
|
+
|
|
562
|
+
For indeterminate progress, simply set the `amount` to the `max`. If these two values are identical, the progress bar is shown in an "indeterminate" state (e.g. the filled portion of the bar is drawn in a different color, default `gray`). This is to handle cases where a job "sits at 100%" but isn't quite complete, and also handle deliberate intermintate jobs (i.e. your code can just set the `amount` to the `max` to show an interminate bar). This also hides the time remaining.
|
|
563
|
+
|
|
564
|
+
For an additional UI hint, if you know your job is going to be indeterminate from the start, set the `pct` option to `false` to hide the percentage display. Otherwise it'll show "100%" during indeterminacy.
|
|
565
|
+
|
|
557
566
|
### Changing Color Styles
|
|
558
567
|
|
|
559
568
|
The progress bar uses a set of color styles from the [chalk](https://www.npmjs.com/package/chalk) module or a custom function for the spinner, braces, bar chunks, percentage display, remaining time, and your custom text (if applicable). To customize these, pass in a `styles` object with the following keys:
|
|
@@ -574,7 +583,7 @@ cli.progress.start({
|
|
|
574
583
|
|
|
575
584
|
Each key should be set to an array of styles supported by the [chalk](https://www.npmjs.com/package/chalk) module or a function. These are arrays because each component may contain multiple styles. For example, by default the `spinner`, `bar` and `pct` are styled with both a color and `bold`.
|
|
576
585
|
|
|
577
|
-
The `indeterminate` style is applied to the filled portion of the bar when the `amount` is exactly equal to the `max`.
|
|
586
|
+
The `indeterminate` style is applied to the filled portion of the bar when the `amount` is exactly equal to the `max`.
|
|
578
587
|
|
|
579
588
|
### Automatic Width
|
|
580
589
|
|
package/cli.js
CHANGED
|
@@ -526,6 +526,7 @@ var cli = module.exports = {
|
|
|
526
526
|
remain: ['green'],
|
|
527
527
|
text: []
|
|
528
528
|
},
|
|
529
|
+
pct: true,
|
|
529
530
|
width: 30,
|
|
530
531
|
freq: 100,
|
|
531
532
|
remain: true,
|
|
@@ -630,11 +631,13 @@ var cli = module.exports = {
|
|
|
630
631
|
|
|
631
632
|
line += cli.applyStyles( bar, (args.amount === args.max) ? args.styles.indeterminate : args.styles.bar );
|
|
632
633
|
line += cli.applyStyles( args.braces[1], args.styles.braces );
|
|
633
|
-
line += " ";
|
|
634
634
|
|
|
635
635
|
// percentage
|
|
636
|
-
|
|
637
|
-
|
|
636
|
+
if (args.pct) {
|
|
637
|
+
line += " ";
|
|
638
|
+
var pct = cli.pct(args.amount, args.max, true);
|
|
639
|
+
line += cli.applyStyles( pct, args.styles.pct );
|
|
640
|
+
}
|
|
638
641
|
|
|
639
642
|
// remaining
|
|
640
643
|
var now = Tools.timeNow();
|
package/package.json
CHANGED