mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) promise -> async
This commit is contained in:
parent
de9a26f8ff
commit
30173e2a5c
1 changed files with 9 additions and 11 deletions
|
|
@ -145,7 +145,7 @@ else if (args.help)
|
|||
else
|
||||
main();
|
||||
|
||||
function main() {
|
||||
async function main() {
|
||||
if (args.repl)
|
||||
repl();
|
||||
|
||||
|
|
@ -211,10 +211,11 @@ function main() {
|
|||
|
||||
const distribute = require('../server/distribute');
|
||||
const importConfig = promisify(distribute.import);
|
||||
const caller = (fn) => fn();
|
||||
|
||||
importConfig(config)
|
||||
.then(args.save ? caller(config.write) : noop);
|
||||
await importConfig(config)
|
||||
|
||||
if (args.save)
|
||||
config.write();
|
||||
|
||||
start(options, config);
|
||||
}
|
||||
|
|
@ -304,17 +305,14 @@ function repl() {
|
|||
require(DIR_SERVER + 'repl');
|
||||
}
|
||||
|
||||
function checkUpdate() {
|
||||
async function checkUpdate() {
|
||||
const load = require('package-json');
|
||||
|
||||
load(Info.name, 'latest')
|
||||
.then(showUpdateInfo)
|
||||
.catch(noop);
|
||||
const {version} = await load(Info.name, 'latest')
|
||||
showUpdateInfo(version);
|
||||
}
|
||||
|
||||
function showUpdateInfo(data) {
|
||||
const {version} = data;
|
||||
|
||||
function showUpdateInfo(version) {
|
||||
if (version === Info.version)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue