pretty-ms-cli
Advanced tools
+25
-15
| #!/usr/bin/env node | ||
| 'use strict'; | ||
| const getStdin = require('get-stdin'); | ||
| const meow = require('meow'); | ||
| const prettyMs = require('pretty-ms'); | ||
| import process from 'node:process'; | ||
| import getStdin from 'get-stdin'; | ||
| import meow from 'meow'; | ||
| import prettyMs from 'pretty-ms'; | ||
| const cli = meow(` | ||
| Usage | ||
| $ pretty-ms <milliseconds> [--compact] [--verbose] [--sec-decimal-digits=<number>] | ||
| $ pretty-ms <milliseconds> [--compact] [--verbose] [--seconds-decimal-digits=<number>] | ||
| echo <milliseconds> | pretty-ms | ||
| Options | ||
| -c, --compact Only show the first part | ||
| -v, --verbose Use full-length units | ||
| -d, --sec-decimal-digits Number of digits to appear after the seconds decimal point | ||
| -c, --compact Only show the first part | ||
| -v, --verbose Use full-length units | ||
| -d, --seconds-decimal-digits Number of digits to appear after the seconds decimal point | ||
@@ -24,10 +24,20 @@ Examples | ||
| ~1s | ||
| $ pretty-ms 1337 --sec-decimal-digits=4 | ||
| $ pretty-ms 1337 --seconds-decimal-digits=4 | ||
| 1.3370s | ||
| `, { | ||
| alias: { | ||
| c: 'compact', | ||
| v: 'verbose', | ||
| d: 'sec-decimal-digits' | ||
| } | ||
| importMeta: import.meta, | ||
| flags: { | ||
| compact: { | ||
| type: 'boolean', | ||
| shortFlag: 'c', | ||
| }, | ||
| verbose: { | ||
| type: 'boolean', | ||
| shortFlag: 'v', | ||
| }, | ||
| secondsDecimalDigits: { | ||
| type: 'boolean', | ||
| shortFlag: 'd', | ||
| }, | ||
| }, | ||
| }); | ||
@@ -49,3 +59,3 @@ | ||
| } else { | ||
| getStdin().then(init); | ||
| init(await getStdin()); | ||
| } |
+53
-51
| { | ||
| "name": "pretty-ms-cli", | ||
| "version": "2.0.0", | ||
| "description": "Convert milliseconds to a human readable string: 1337000000 → 15d 11h 23m 20s", | ||
| "license": "MIT", | ||
| "repository": "sindresorhus/pretty-ms-cli", | ||
| "author": { | ||
| "name": "Sindre Sorhus", | ||
| "email": "sindresorhus@gmail.com", | ||
| "url": "sindresorhus.com" | ||
| }, | ||
| "bin": { | ||
| "pretty-ms": "cli.js" | ||
| }, | ||
| "engines": { | ||
| "node": ">=4" | ||
| }, | ||
| "scripts": { | ||
| "test": "xo && ava" | ||
| }, | ||
| "files": [ | ||
| "cli.js" | ||
| ], | ||
| "keywords": [ | ||
| "cli-app", | ||
| "cli", | ||
| "pretty", | ||
| "prettify", | ||
| "human", | ||
| "humanize", | ||
| "humanized", | ||
| "readable", | ||
| "time", | ||
| "ms", | ||
| "milliseconds", | ||
| "duration", | ||
| "period", | ||
| "range", | ||
| "text", | ||
| "string", | ||
| "str", | ||
| "number" | ||
| ], | ||
| "dependencies": { | ||
| "get-stdin": "^5.0.1", | ||
| "meow": "^3.5.0", | ||
| "pretty-ms": "^2.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "*", | ||
| "xo": "*" | ||
| } | ||
| "name": "pretty-ms-cli", | ||
| "version": "3.0.0", | ||
| "description": "Convert milliseconds to a human readable string: 1337000000 → 15d 11h 23m 20s", | ||
| "license": "MIT", | ||
| "repository": "sindresorhus/pretty-ms-cli", | ||
| "funding": "https://github.com/sponsors/sindresorhus", | ||
| "author": { | ||
| "name": "Sindre Sorhus", | ||
| "email": "sindresorhus@gmail.com", | ||
| "url": "https://sindresorhus.com" | ||
| }, | ||
| "type": "module", | ||
| "bin": { | ||
| "pretty-ms": "./cli.js" | ||
| }, | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
| "scripts": { | ||
| "test": "xo && ava" | ||
| }, | ||
| "files": [ | ||
| "cli.js" | ||
| ], | ||
| "keywords": [ | ||
| "cli-app", | ||
| "cli", | ||
| "pretty", | ||
| "prettify", | ||
| "human", | ||
| "humanize", | ||
| "humanized", | ||
| "readable", | ||
| "time", | ||
| "ms", | ||
| "milliseconds", | ||
| "duration", | ||
| "period", | ||
| "range", | ||
| "text", | ||
| "string", | ||
| "number" | ||
| ], | ||
| "dependencies": { | ||
| "get-stdin": "^9.0.0", | ||
| "meow": "^13.2.0", | ||
| "pretty-ms": "^9.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "ava": "^6.1.2", | ||
| "execa": "^8.0.1", | ||
| "xo": "^0.58.0" | ||
| } | ||
| } |
+9
-17
@@ -1,13 +0,11 @@ | ||
| # pretty-ms-cli [](https://travis-ci.org/sindresorhus/pretty-ms-cli) | ||
| # pretty-ms-cli | ||
| > Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s` | ||
| ## Install | ||
| ```sh | ||
| npm install --global pretty-ms-cli | ||
| ``` | ||
| $ npm install --global pretty-ms-cli | ||
| ``` | ||
| ## Usage | ||
@@ -19,9 +17,9 @@ | ||
| Usage | ||
| $ pretty-ms <milliseconds> [--compact] [--verbose] [--sec-decimal-digits=<number>] | ||
| $ pretty-ms <milliseconds> [--compact] [--verbose] [--seconds-decimal-digits=<number>] | ||
| echo <milliseconds> | pretty-ms | ||
| Options | ||
| -c, --compact Only show the first part | ||
| -v, --verbose Use full-length units | ||
| -d, --sec-decimal-digits Number of digits to appear after the seconds decimal point | ||
| -c, --compact Only show the first part | ||
| -v, --verbose Use full-length units | ||
| -d, --seconds-decimal-digits Number of digits to appear after the seconds decimal point | ||
@@ -35,14 +33,8 @@ Examples | ||
| ~1s | ||
| $ pretty-ms 1337 --sec-decimal-digits=4 | ||
| $ pretty-ms 1337 --seconds-decimal-digits=4 | ||
| 1.3370s | ||
| ``` | ||
| ## Related | ||
| - [pretty-ms](https://github.com/sindresorhus/pretty-ms) - API for this module | ||
| ## License | ||
| MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
| - [pretty-ms](https://github.com/sindresorhus/pretty-ms) - API for this package |
Sorry, the diff of this file is not supported yet
4090
0.39%52
23.81%Yes
NaN3
50%39
-17.02%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated