@danmasta/interpolate
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -11,3 +11,3 @@ #!/usr/bin/env node | ||
--string -s - Text string to parse | ||
--stdin - Read input from stdin | ||
--stdin - - Read input from stdin | ||
--json -j - Handle input as json | ||
@@ -31,3 +31,3 @@ --key -k - If input is json, parse data at specified key | ||
string: 's', | ||
stdin: null, | ||
stdin: '-', | ||
json: 'j', | ||
@@ -34,0 +34,0 @@ key: 'k', |
@@ -14,3 +14,3 @@ #!/usr/bin/env node | ||
--string -s - Text string to parse | ||
--stdin - Read input from stdin | ||
--stdin - - Read input from stdin | ||
--env -e - If true will also interpolate from envrionment variables | ||
@@ -37,3 +37,3 @@ --params -p - Stringified json object, or string of key,value pairs: key1=1,key2=2 | ||
string: 's', | ||
stdin: null, | ||
stdin: '-', | ||
env: 'e', | ||
@@ -40,0 +40,0 @@ params: 'p', |
@@ -25,3 +25,22 @@ const minimist = require('minimist'); | ||
let argv = _.transform(minimist(process.argv.slice(2)), (res, val, key) => { | ||
res[_.camelCase(key)] = toNativeType(val); | ||
val = toNativeType(val); | ||
// Support '-' arg for stdin | ||
if (key === '_') { | ||
if (val[0] === '-') { | ||
res['-'] = true; | ||
val.shift(); | ||
} | ||
if (val.length) { | ||
res[key] = val; | ||
} | ||
} else { | ||
if (val === '-') { | ||
res['-'] = true; | ||
val = true; | ||
} | ||
res[_.camelCase(key)] = val; | ||
} | ||
}); | ||
@@ -28,0 +47,0 @@ |
{ | ||
"name": "@danmasta/interpolate", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"author": "Daniel Smith <dannmasta@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Simple string interpolation helper", |
@@ -32,3 +32,3 @@ # Interpolate | ||
`string` | s | *`string`* | Text string to parse. Default is `undefined` | ||
`stdin` | | *`boolean`* | Read input from stdin. Default is `false` | ||
`stdin` | - | *`boolean`* | Read input from stdin. Default is `false` | ||
`env` | e | *`boolean`* | If true will also interpolate with environment variables. Default is `false` | ||
@@ -57,3 +57,3 @@ `params` | p | *`object\|string`* | Object of key,value pairs to use for parameter matching. If string, it should either be a stringified json object, or a comma-separated key,value list: `"key1=1,key2=2"`. Default is `undefined` | ||
`string` | s | *`string`* | Text string to parse. Default is `undefined` | ||
`stdin` | | *`boolean`* | Read input from stdin. Default is `undefined` | ||
`stdin` | - | *`boolean`* | Read input from stdin. Default is `undefined` | ||
`json` | j | *`boolean`* | Handle input as json. Default is `false` | ||
@@ -60,0 +60,0 @@ `key` | k | *`string`* | If input is json, parse data at specified key. Default is `undefined` |
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
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
21061
455