cli-placeholders
Advanced tools
Comparing version 1.0.0 to 1.0.1
26
index.js
@@ -87,3 +87,3 @@ const assert = require('assert') | ||
const placeholders = template.match(/\{(.*?)\}/g) | ||
const placeholders = template.match(/\{(.*?)\}/g) || [] | ||
@@ -150,2 +150,10 @@ this._placeholders = [] | ||
get summary () { | ||
return { | ||
template: this._template, | ||
text: this.text, | ||
results: this.results | ||
} | ||
} | ||
render () { | ||
@@ -188,2 +196,7 @@ let offset = 0 | ||
if (!this._placeholders.length) { | ||
this.rl.close() | ||
return this.summary | ||
} | ||
return new Promise((resolve) => { | ||
@@ -198,8 +211,3 @@ process.stdin.on('keypress', async (character = '', key) => { | ||
this.rl.close() | ||
return resolve({ | ||
template: this._template, | ||
text: this.text, | ||
results: this.results | ||
}) | ||
return resolve(this.summary) | ||
} | ||
@@ -221,3 +229,3 @@ | ||
this.render() | ||
const command = this._commands[placeholder.value] | ||
@@ -245,3 +253,3 @@ if (command) { | ||
module.exports = async (template, options) => { | ||
return await new Template(template, options).getValues() | ||
return await new Template(template, options).getValues() | ||
} |
{ | ||
"name": "cli-placeholders", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Get user input by extracting data from textual placeholders using the CLI", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
6057
195