pixl-cli 1.0.19 → 1.0.20

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/cli.js +2 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -564,6 +564,7 @@ cli.progress.start({
564
564
  spinner: ['bold', 'green'],
565
565
  braces: ['gray'],
566
566
  bar: ['bold', 'cyan'],
567
+ indeterminate: ['gray'],
567
568
  pct: ['bold', 'yellow'],
568
569
  remain: ['green'],
569
570
  text: [function( text ) { return text.toUpperCase() }]
@@ -573,6 +574,8 @@ cli.progress.start({
573
574
 
574
575
  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`.
575
576
 
577
+ The `indeterminate` style is applied to the filled portion of the bar when the `amount` is exactly equal to the `max`. 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.
578
+
576
579
  ### Automatic Width
577
580
 
578
581
  To set the progress bar size automatically to take up the full width of your Terminal window, you can use the `cli.width()` function. Just subtract 27 characters from it (possibly more if you use `indent` or `text`) to account for the spinner, braces, percentage and remaining time:
package/cli.js CHANGED
@@ -521,6 +521,7 @@ var cli = module.exports = {
521
521
  spinner: ['bold', 'green'],
522
522
  braces: ['gray'],
523
523
  bar: ['bold', 'cyan'],
524
+ indeterminate: ['gray'],
524
525
  pct: ['bold', 'yellow'],
525
526
  remain: ['green'],
526
527
  text: []
@@ -627,7 +628,7 @@ var cli = module.exports = {
627
628
  }
628
629
  bar += cli.space(args.width - stringWidth(bar));
629
630
 
630
- line += cli.applyStyles( bar, args.styles.bar );
631
+ line += cli.applyStyles( bar, (args.amount === args.max) ? args.styles.indeterminate : args.styles.bar );
631
632
  line += cli.applyStyles( args.braces[1], args.styles.braces );
632
633
  line += " ";
633
634
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-cli",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Tools for building command-line apps for Node.js.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-cli",