better readability

This commit is contained in:
jash
2018-10-08 18:10:48 +02:00
committed by kexkey
parent 153a7b5d36
commit b314ee5b05
6 changed files with 82 additions and 22 deletions

View File

@@ -1,5 +1,15 @@
const chalk = require('chalk');
const name = 'proxy';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
module.exports = {
name: function() {
return name;
@@ -10,14 +20,14 @@ module.exports = {
// input, confirm, list, rawlist, expand, checkbox, password, editor
type: 'checkbox',
name: 'features',
message: 'What features do you want to add to your cyphernode?'+'\n',
message: prefix()+'What features do you want to add to your cyphernode?'+'\n',
choices: utils._featureChoices()
},
{
type: 'list',
name: 'net',
default: utils._getDefault( 'net' ),
message: 'What net do you want to run on?'+'\n',
message: prefix()+'What net do you want to run on?'+'\n',
choices: [{
name: "Testnet",
value: "testnet"
@@ -30,14 +40,14 @@ module.exports = {
type: 'input',
name: 'xpub',
default: utils._getDefault( 'xpub' ),
message: 'What is your xpub to watch?'+'\n',
message: prefix()+'What is your xpub to watch?'+'\n',
validate: utils._xkeyValidator
},
{
type: 'input',
name: 'derivation_path',
default: utils._getDefault( 'derivation_path' ),
message: 'What is your address derivation path?'+'\n',
message: prefix()+'What is your address derivation path?'+'\n',
validate: utils._derivationPathValidator
}];
},

View File

@@ -1,4 +1,15 @@
const chalk = require('chalk');
const name = 'bitcoin';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
const bitcoinExternal = function(props) {
return props.bitcoin_mode === 'external'
};
@@ -17,7 +28,7 @@ module.exports = {
type: 'list',
name: 'bitcoin_mode',
default: utils._getDefault( 'bitcoin_mode' ),
message: 'Where is your bitcoin full node running?'+'\n',
message: prefix()+'Where is your bitcoin full node running?'+'\n',
choices: [
{
name: 'Nowhere! I want cyphernode to run one.',
@@ -35,33 +46,33 @@ module.exports = {
name: 'bitcoin_node_ip',
default: utils._getDefault( 'bitcoin_node_ip' ),
validate: utils._ipOrFQDNValidator,
message: 'What is your full node ip address?'+'\n',
message: prefix()+'What is your full node ip address?'+'\n',
},
{
type: 'input',
name: 'bitcoin_rpcuser',
default: utils._getDefault( 'bitcoin_rpcuser' ),
message: 'Name of bitcoin rpc user?'+'\n',
message: prefix()+'Name of bitcoin rpc user?'+'\n',
},
{
type: 'password',
name: 'bitcoin_rpcpassword',
default: utils._getDefault( 'bitcoin_rpcpassword' ),
message: 'Password of bitcoin rpc user?'+'\n',
message: prefix()+'Password of bitcoin rpc user?'+'\n',
},
{
when: bitcoinInternal,
type: 'confirm',
name: 'bitcoin_prune',
default: utils._getDefault( 'bitcoin_prune' ),
message: 'Run bitcoin node in prune mode?'+'\n',
message: prefix()+'Run bitcoin node in prune mode?'+'\n',
},
{
when: bitcoinInternal,
type: 'input',
name: 'bitcoin_uacomment',
default: utils._getDefault( 'bitcoin_uacomment' ),
message: 'Any UA comment?'+'\n',
message: prefix()+'Any UA comment?'+'\n',
}];
},
env: function( props ) {

View File

@@ -1,14 +1,24 @@
const path = require('path');
const chalk = require('chalk');
const name = 'lightning';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
const featureCondition = function(props) {
return props.features && props.features.indexOf( name ) != -1;
}
};
const templates = {
'lnd': [ path.join('lnd','lnd.conf') ],
'c-lightning': [ path.join('c-lightning','config') ]
}
};
module.exports = {
name: function() {
@@ -20,7 +30,7 @@ module.exports = {
type: 'list',
name: 'lightning_implementation',
default: utils._getDefault( 'lightning_implementation' ),
message: 'What lightning implementation do you want to use?'+'\n',
message: prefix()+'What lightning implementation do you want to use?'+'\n',
choices: [
{
name: 'C-lightning',

View File

@@ -1,7 +1,18 @@
const chalk = require('chalk');
const name = 'electrum';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
const featureCondition = function(props) {
return props.features && props.features.indexOf( name ) != -1;
}
};
module.exports = {
name: function() {
@@ -13,7 +24,7 @@ module.exports = {
type: 'list',
name: 'electrum_implementation',
default: utils._getDefault( 'electrum_implementation' ),
message: 'What electrum implementation do you want to use?'+'\n',
message: prefix()+'What electrum implementation do you want to use?'+'\n',
choices: [
{
name: 'Electrum personal server',

View File

@@ -1,8 +1,18 @@
const chalk = require('chalk');
const name = 'otsclient';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
const featureCondition = function(props) {
return props.features && props.features.indexOf( name ) != -1;
}
};
module.exports = {
name: function() {

View File

@@ -3,6 +3,14 @@ const chalk = require('chalk');
const name = 'installer';
const capitalise = function( txt ) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
};
const prefix = function() {
return chalk.green(capitalise(name)+': ');
};
const installerDocker = function(props) {
return props.installer_mode === 'docker'
};
@@ -20,7 +28,7 @@ module.exports = {
type: 'list',
name: 'installer_mode',
default: utils._getDefault( 'installer_mode' ),
message: chalk.red('Where do you want to install cyphernode?')+'\n',
message: prefix()+chalk.red('Where do you want to install cyphernode?')+'\n',
choices: [{
name: "Docker",
value: "docker"
@@ -36,7 +44,7 @@ module.exports = {
name: 'proxy_datapath',
default: utils._getDefault( 'proxy_datapath' ),
validate: utils._pathValidator,
message: 'Where to store your proxy db?'+'\n',
message: prefix()+'Where to store your proxy db?'+'\n',
},
{
when: function(props) { return installerDocker(props) && props.bitcoin_mode === 'internal' },
@@ -44,7 +52,7 @@ module.exports = {
name: 'bitcoin_datapath',
default: utils._getDefault( 'bitcoin_datapath' ),
validate: utils._pathValidator,
message: 'Where is your blockchain data?'+'\n',
message: prefix()+'Where is your blockchain data?'+'\n',
},
{
when: function(props) { return installerDocker(props) && props.features.indexOf('lightning') !== -1 },
@@ -52,21 +60,21 @@ module.exports = {
name: 'lightning_datapath',
default: utils._getDefault( 'lightning_datapath' ),
validate: utils._pathValidator,
message: 'Where is your lightning node data?'+'\n',
message: prefix()+'Where is your lightning node data?'+'\n',
},
{
when: function(props) { return installerDocker(props) && props.bitcoin_mode === 'internal' },
type: 'confirm',
name: 'bitcoin_expose',
default: utils._getDefault( 'bitcoin_expose' ),
message: 'Expose bitcoin full node outside of the docker network?'+'\n',
message: prefix()+'Expose bitcoin full node outside of the docker network?'+'\n',
},
{
when: installerLunanode,
type: 'confirm',
name: 'installer_confirm_lunanode',
default: utils._getDefault( 'installer_confirm_lunanode' ),
message: 'Lunanode?! No wayyyy!'+'\n'
message: prefix()+'Lunanode?! No wayyyy!'+'\n'
}];
},
templates: function( props ) {