Comparing version 0.1.0 to 0.1.1
@@ -1,3 +0,11 @@ | ||
### 0.1.0 | ||
### [0.1.1](https://github.com/Fishrock123/cli-status/commits/v0.1.1) | ||
* Now tests via `$> npm test` | ||
* All bars are now calculated the same way. | ||
* (!) Fixed bars with a progress of 1 showing a completed bar. | ||
--- | ||
### [0.1.0](https://github.com/Fishrock123/cli-status/commits/v0.1.0) | ||
* Initial release. | ||
@@ -10,4 +18,4 @@ * Everything is handled in-module without instances. | ||
* - fn: start(fn:polling) | ||
* - fn: end | ||
* - fn: end() | ||
--- |
18
index.js
@@ -25,11 +25,11 @@ | ||
barCalculator = function(frac) { | ||
barCalculator = function() { | ||
if (progress < 0 || progress > total || isNaN(progress)) return false; | ||
if (ended && progress < total) ended = false; | ||
barLength = Math.floor(length * (frac ? progress / frac : progress)); | ||
if (barLength == 0 && progress > 0) barLength = total; | ||
barLength = Math.floor(length * (progress / total)); | ||
if (barLength == 0 && progress > 0) barLength = (total >= 10 ? 1 : 0); | ||
return true; | ||
}; | ||
checkEnded = function(progress) { | ||
checkEnded = function() { | ||
if (ended || (ended = (progress >= total))) { | ||
@@ -49,7 +49,7 @@ if (stepper) clearInterval(stepper); | ||
stepPercent = function(prog) { | ||
if (progress === prog / total) return; | ||
progress = prog / total; | ||
if (progress === prog) return; | ||
progress = prog; | ||
if (!barCalculator()) return; | ||
process.stdout.write(' ' + prefix + ' [' + makeBar() + '] ' + Math.floor(progress * 100) + '% ' + suffix + checkEnded(prog)); | ||
process.stdout.write(' ' + prefix + ' [' + makeBar() + '] ' + Math.floor((progress / total) * 100) + '% ' + suffix + checkEnded()); | ||
}; | ||
@@ -60,5 +60,5 @@ | ||
progress = prog; | ||
if (!barCalculator(total)) return; | ||
if (!barCalculator()) return; | ||
process.stdout.write(' ' + prefix + ' [' + makeBar() + '] ' + progress + '/' + total + ' ' + suffix + checkEnded(progress)); | ||
process.stdout.write(' ' + prefix + ' [' + makeBar() + '] ' + progress + '/' + total + ' ' + suffix + checkEnded()); | ||
}; | ||
@@ -65,0 +65,0 @@ |
@@ -5,3 +5,3 @@ `cli-status` is distributed under the [MIT License](https://en.wikipedia.org/wiki/MIT_License) which basically means you can do anything you want commercial or private provided you keep the copyright within the source files intact. If you'd like to contribute to the project please [fork](https://github.com/fishrock123/cli-status/fork) and issue a pull request. | ||
Copyright (c) 2013 Jeremiah Senkpiel ("Fishrock123") | ||
Copyright (c) 2013 Jeremiah Senkpiel ("Fishrock123") <fishrock123@rocketmail.com> | ||
@@ -8,0 +8,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "cli-status", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Highly configurable status indicators for your node.js cli.", | ||
@@ -11,3 +11,2 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/fishrock123/cli-status", | ||
"author": { | ||
@@ -29,3 +28,6 @@ "name": "Jeremiah Senkpiel", | ||
}, | ||
"scripts" : { | ||
"test": "node test.js" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -25,3 +25,3 @@ # [cli-status](https://npmjs.org/package/cli-status) | ||
##### Manual stepping: | ||
#### Manual stepping: | ||
```js | ||
@@ -39,3 +39,3 @@ var status = require('cli-status'); | ||
##### Automatic polling: | ||
#### Automatic polling: | ||
```js | ||
@@ -64,4 +64,4 @@ var status = require('cli-status'); | ||
Clone the repo, then run: | ||
Install or clone the repo, then run: | ||
$> node test.js | ||
$> npm test |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11800
7
304
2