mirror of
https://github.com/alexbosworth/balanceofsatoshis.git
synced 2026-08-13 12:33:37 +02:00
avoid non-standard input types
This commit is contained in:
parent
9fad1fab89
commit
c06ff5a953
5 changed files with 35 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Versions
|
||||
|
||||
## 22.1.2
|
||||
## 22.1.3
|
||||
|
||||
- Improve support for SOCKS proxy on old node versions
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const {getNodeAlias} = require('ln-sync');
|
|||
const {returnResult} = require('asyncjs-util');
|
||||
|
||||
const {calls} = require('./api');
|
||||
const promptType = require('./prompt_type');
|
||||
|
||||
const {assign} = Object;
|
||||
const fromLnSync = 'ln-sync';
|
||||
|
|
@ -126,7 +127,7 @@ module.exports = ({ask, lnd, logger, method, params}, cbk) => {
|
|||
name: named,
|
||||
prefix: `[${named}]`,
|
||||
suffix: !!argument.optional ? ' (Optional)' : String(),
|
||||
type: argument.type || 'input',
|
||||
type: promptType({type: argument.type}).type || 'input',
|
||||
validate: async input => {
|
||||
const isNumber = argument.type === 'number';
|
||||
|
||||
|
|
|
|||
29
commands/prompt_type.js
Normal file
29
commands/prompt_type.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/** Derive a prompt type from an argument type
|
||||
|
||||
{
|
||||
type: <Prompt Type String>
|
||||
}
|
||||
|
||||
@returns
|
||||
{
|
||||
[type]: <Sanitized Prompt Type String>
|
||||
}
|
||||
*/
|
||||
module.exports = ({type}) => {
|
||||
switch (type) {
|
||||
case 'checkbox':
|
||||
case 'confirm':
|
||||
case 'editor':
|
||||
case 'expand':
|
||||
case 'input':
|
||||
case 'number':
|
||||
case 'password':
|
||||
case 'rawlist':
|
||||
case 'search':
|
||||
case 'select':
|
||||
return {type};
|
||||
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
};
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "balanceofsatoshis",
|
||||
"version": "22.1.2",
|
||||
"version": "22.1.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "balanceofsatoshis",
|
||||
"version": "22.1.2",
|
||||
"version": "22.1.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alexbosworth/blockchain": "3.2.0",
|
||||
|
|
|
|||
|
|
@ -81,5 +81,5 @@
|
|||
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
|
||||
"test": "npx nyc@17.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js"
|
||||
},
|
||||
"version": "22.1.2"
|
||||
"version": "22.1.3"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue