瀏覽代碼

Fixes for elxr use and prompts

master
guest 3 年之前
父節點
當前提交
722dcfd066
共有 2 個檔案被更改,包括 19 行新增11 行删除
  1. 2
    1
      cliverse.js
  2. 17
    10
      index.js

+ 2
- 1
cliverse.js 查看文件

@@ -92,8 +92,9 @@ function nodeShellExec() {
var prompt = function(choices, label, defaultchoice){
// prompt accepts either an array or an object as choices.
var choices = choices || [];
defaultchoice = defaultchoice || choices[0] || choices[Object.keys(choices)[0]]
return this.prompter.ask(
`${label} \n` + Object.keys(choices).map(choice => { return ` ${(+choice) + 1}) ${choices[choice]} `}).join('\n') + `\n default ( <= ${ defaultchoice || choices[0]} ) : `
`${label} \n` + Object.keys(choices).map(choice => { var choice_label = isNaN(+choice) ? choice : choice; return ` ${choice_label}) ${choices[choice]} `}).join('\n') + `\n default ( <= ${ defaultchoice || choices[0]} ) : `
).then(choice => {
// propName = promptable.interpret(propValue)
if(!choice) return defaultchoice || choices[0];

+ 17
- 10
index.js 查看文件

@@ -320,7 +320,7 @@ var performPull = (repo, branch, repoowner, errHandler) => {
env: process.env
, cwd: instanceroot + '/' + repo
, runas: processedArgs.runas
, title: `'git', ${['config', '--replace-all', 'user.name', username].join(' ')}`
, title: `'git', ${['config', '--replace-all', 'user.name', selectedinstance.username].join(' ')}`
})
.then(() => {
if (__isElevated) {
@@ -2294,16 +2294,22 @@ var __acquireConfig = function (selected, owner, clusternodename, configrepo, er
}

if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${owner}/${configrepo}.git/' not found`))){
return cli.prompt( { i : 'install new instance with this name locally'
, f : 'fork a new instance for yourself from another instance'
, o : 'fork a new instance for your organization' // prompt organization name...
, c : 'create a custom personal instance for this node' // prompt hostname as nodename
, p : 'create a custom personal instance'
return cli.prompt( {
t : 'install a new temporary local instance with this name'
, i : 'create a new instance with this name => will fork the default config under your username'
, f : 'fork a new instance with this name for yourself for this node from another instance'
, o : 'fork a new instance with this name for your organization from another instance' // prompt organization name...
, c : 'create a custom config for yourself for this node' // prompt hostname as nodename
, p : 'create a custom config for yourself '
, e : 'exit'}
, 'Config for instance not found. Would you like to ', 'e' ).then(propValue => {
if(propValue === 'i') return eNotImplemented() // return createLocalChessInsance(selectedinstance)
if(propValue === 'f') return eNotImplemented() // return createChessInstance(selectedinstance)
if(propValue === 't') return eNotImplemented()
if(propValue === 'i') return eNotImplemented()
if(propValue === 'f') return eNotImplemented()
if(propValue === 'o') return eNotImplemented()
if(propValue === 'c') return eNotImplemented() // return createLocalChessInsance(selectedinstance)
if(propValue === 'p') return eNotImplemented() // return createChessInstance(selectedinstance)
// if(propValue === 'o') createChessInstance(selectedinstance, orgname)
else process.exit()
})
@@ -3076,8 +3082,9 @@ var promptkeys = {

function createLocalChessInstance( cfg ){
// return createInstance(cfg)
reconfirm = getReconfirmAll()
var inst = {};
var __new = Object.assign({}, /*__default,*/ cfg)
var __new = Object.assign({}, __default, cfg)
inst[cfg.node_env] = __new; return inst;
}


Loading…
取消
儲存