Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-03-23 03:00:19 +0300
committerRebecca Turner <me@re-becca.org>2018-03-23 12:08:57 +0300
commit07f27ee898f3c3199e75427017f2b6a189b1a85b (patch)
tree78207c7886939174ca9f6a604b241395a528e743 /node_modules/qrcode-terminal
parent588eabd23fa04420269b9326cab26d974d9c151f (diff)
qrcode-terminal@0.12.0
Changes to the qrcode cli. Credit: @kblum
Diffstat (limited to 'node_modules/qrcode-terminal')
-rw-r--r--node_modules/qrcode-terminal/.npmignore2
-rw-r--r--node_modules/qrcode-terminal/README.md1
-rwxr-xr-xnode_modules/qrcode-terminal/bin/qrcode-terminal.js65
-rw-r--r--node_modules/qrcode-terminal/package.json22
4 files changed, 61 insertions, 29 deletions
diff --git a/node_modules/qrcode-terminal/.npmignore b/node_modules/qrcode-terminal/.npmignore
deleted file mode 100644
index 1ca957177..000000000
--- a/node_modules/qrcode-terminal/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules/
-npm-debug.log
diff --git a/node_modules/qrcode-terminal/README.md b/node_modules/qrcode-terminal/README.md
index 53da6c3d8..f5c830f20 100644
--- a/node_modules/qrcode-terminal/README.md
+++ b/node_modules/qrcode-terminal/README.md
@@ -51,6 +51,7 @@ If you want to display small output, provide `opts` with `small`:
$ qrcode-terminal --help
$ qrcode-terminal 'http://github.com'
+ $ echo 'http://github.com' | qrcode-terminal
# Support
diff --git a/node_modules/qrcode-terminal/bin/qrcode-terminal.js b/node_modules/qrcode-terminal/bin/qrcode-terminal.js
index fcc7ee9d9..64762879e 100755
--- a/node_modules/qrcode-terminal/bin/qrcode-terminal.js
+++ b/node_modules/qrcode-terminal/bin/qrcode-terminal.js
@@ -9,35 +9,68 @@ var qrcode = require('../lib/main'),
fs = require('fs');
/*!
- * Parse the process name and input
+ * Parse the process name
*/
-var name = process.argv[1].replace(/^.*[\\\/]/, '').replace('.js', ''),
- input = process.argv[2];
+var name = process.argv[1].replace(/^.*[\\\/]/, '').replace('.js', '');
/*!
- * Display help
+ * Parse the input
*/
-if (!input || input === '-h' || input === '--help') {
- help();
- process.exit();
-}
+if (process.stdin.isTTY) {
+ // called with input as argument, e.g.:
+ // ./qrcode-terminal.js "INPUT"
-/*!
- * Display version
- */
+ var input = process.argv[2];
+ handleInput(input);
+} else {
+ // called with piped input, e.g.:
+ // echo "INPUT" | ./qrcode-terminal.js
-if (input === '-v' || input === '--version') {
- version();
- process.exit();
+ var readline = require('readline');
+
+ var interface = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false
+ });
+
+ interface.on('line', function(line) {
+ handleInput(line);
+ });
}
/*!
- * Render the QR Code
+ * Process the input
*/
-qrcode.generate(input);
+function handleInput(input) {
+
+ /*!
+ * Display help
+ */
+
+ if (!input || input === '-h' || input === '--help') {
+ help();
+ process.exit();
+ }
+
+ /*!
+ * Display version
+ */
+
+ if (input === '-v' || input === '--version') {
+ version();
+ process.exit();
+ }
+
+ /*!
+ * Render the QR Code
+ */
+
+ qrcode.generate(input);
+}
/*!
* Helper functions
diff --git a/node_modules/qrcode-terminal/package.json b/node_modules/qrcode-terminal/package.json
index fd1e2f2b7..62ddb7ca1 100644
--- a/node_modules/qrcode-terminal/package.json
+++ b/node_modules/qrcode-terminal/package.json
@@ -1,27 +1,27 @@
{
- "_from": "qrcode-terminal",
- "_id": "qrcode-terminal@0.11.0",
+ "_from": "qrcode-terminal@0.12.0",
+ "_id": "qrcode-terminal@0.12.0",
"_inBundle": false,
- "_integrity": "sha1-/8bCii/Av7RwUrR+I/T0RqX7254=",
+ "_integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==",
"_location": "/qrcode-terminal",
"_phantomChildren": {},
"_requested": {
- "type": "tag",
+ "type": "version",
"registry": true,
- "raw": "qrcode-terminal",
+ "raw": "qrcode-terminal@0.12.0",
"name": "qrcode-terminal",
"escapedName": "qrcode-terminal",
- "rawSpec": "",
+ "rawSpec": "0.12.0",
"saveSpec": null,
- "fetchSpec": "latest"
+ "fetchSpec": "0.12.0"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.11.0.tgz",
- "_shasum": "ffc6c28a2fc0bfb47052b47e23f4f446a5fbdb9e",
- "_spec": "qrcode-terminal",
+ "_resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",
+ "_shasum": "bb5b699ef7f9f0505092a3748be4464fe71b5819",
+ "_spec": "qrcode-terminal@0.12.0",
"_where": "/Users/rebecca/code/npm",
"bin": {
"qrcode-terminal": "./bin/qrcode-terminal.js"
@@ -72,5 +72,5 @@
"scripts": {
"test": "./node_modules/jshint/bin/jshint lib vendor && node example/basic.js && ./node_modules/mocha/bin/mocha -R nyan"
},
- "version": "0.11.0"
+ "version": "0.12.0"
}