|
|
@ -20,7 +20,16 @@ exports.assignAlias = async (autoAlias, token, deployment, apiUrl, debug, curren |
|
|
|
await aliases.set(String(deployment), String(autoAlias)); |
|
|
|
}; |
|
|
|
|
|
|
|
exports.reAlias = async (token, host, help, exit, apiUrl, debug, alias) => { |
|
|
|
exports.reAlias = async ( |
|
|
|
token, |
|
|
|
host, |
|
|
|
pointer, |
|
|
|
help, |
|
|
|
exit, |
|
|
|
apiUrl, |
|
|
|
debug, |
|
|
|
alias |
|
|
|
) => { |
|
|
|
const path = process.cwd(); |
|
|
|
|
|
|
|
const configFiles = { |
|
|
@ -52,27 +61,33 @@ exports.reAlias = async (token, host, help, exit, apiUrl, debug, alias) => { |
|
|
|
|
|
|
|
let pointers = []; |
|
|
|
|
|
|
|
if (nowConfig.alias) { |
|
|
|
const value = nowConfig.alias; |
|
|
|
|
|
|
|
if (typeof value === 'string') { |
|
|
|
pointers.push(value); |
|
|
|
} else if (Array.isArray(value)) { |
|
|
|
pointers = pointers.concat(nowConfig.alias); |
|
|
|
} else { |
|
|
|
error(`Property ${chalk.grey('aliases')} is not a valid array or string`); |
|
|
|
return exit(1); |
|
|
|
if (pointer) { |
|
|
|
pointers.push(pointer); |
|
|
|
} else { |
|
|
|
if (nowConfig.alias) { |
|
|
|
const value = nowConfig.alias; |
|
|
|
|
|
|
|
if (typeof value === 'string') { |
|
|
|
pointers.push(value); |
|
|
|
} else if (Array.isArray(value)) { |
|
|
|
pointers = pointers.concat(nowConfig.alias); |
|
|
|
} else { |
|
|
|
error( |
|
|
|
`Property ${chalk.grey('aliases')} is not a valid array or string` |
|
|
|
); |
|
|
|
return exit(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (nowConfig.aliases && Array.isArray(nowConfig.aliases)) { |
|
|
|
console.log( |
|
|
|
`${chalk.red('Deprecated!')} The property ${chalk.grey('aliases')} will be ` + |
|
|
|
`removed from the config file soon.` |
|
|
|
); |
|
|
|
console.log('Read more about the new way here: http://bit.ly/2l2v5Fg\n'); |
|
|
|
if (nowConfig.aliases && Array.isArray(nowConfig.aliases)) { |
|
|
|
console.log( |
|
|
|
`${chalk.red('Deprecated!')} The property ${chalk.grey('aliases')} will be ` + |
|
|
|
`removed from the config file soon.` |
|
|
|
); |
|
|
|
console.log('Read more about the new way here: http://bit.ly/2l2v5Fg\n'); |
|
|
|
|
|
|
|
pointers = pointers.concat(nowConfig.aliases); |
|
|
|
pointers = pointers.concat(nowConfig.aliases); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (pointers.length === 0) { |
|
|
|