本文整理匯總了TypeScript中prompt.get函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript get函數的具體用法?TypeScript get怎麽用?TypeScript get使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了get函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Promise
return new Promise((resolve, reject) => {
prompt.message = '';
prompt.start();
let schema = {
properties: {
clientId: {
default: this.clientId,
},
clientSecret: {
default: this.clientSecret,
},
endpoint: {
default: this.endpoint,
},
},
};
prompt.get(schema, (err, result) => {
if (result === undefined) {
return;
}
this.copyFrom(result);
this.write();
resolve(this);
});
});
示例2: _startPrompt
return new Promise<void>(function(fulfill, reject) {
_startPrompt();
let schema = {
properties: {
key: {
description: 'Client key to delete:',
required: true
}
}
};
Prompt.get(schema, function(err, result) {
if (err) {
reject(err);
}
else {
let key = result['key'];
_deleteClient(authenticator, key).then(fulfill).catch(reject);
}
});
});
示例3: resolve
return new Promise<IAnswers>(resolve => {
prompt.get(this.createQuestions(), (err, result) => {
if (err != null) {
console.error(err)
process.exit(1)
} else {
resolve(result)
}
})
})
示例4: promptToUse
function promptToUse(): Q.IPromise<boolean> {
var dfd = Q.defer<boolean>();
prompt.get(use, function (err, result) {
handleError(err);
var useIt = result.use === "y" || result.use === "yes";
dfd.resolve(useIt);
});
return dfd.promise;
}
示例5: promptForWaitTime
function promptForWaitTime(): Q.IPromise<boolean> {
var dfd = Q.defer<boolean>();
prompt.get(wait, function (err, result) {
handleError(err);
config.urls[Object.keys(config.urls)[0]].waitTime = result.wait;
dfd.resolve(true);
});
return dfd.promise;
}
示例6: promptForDest
function promptForDest(): Q.IPromise<boolean> {
var dfd = Q.defer<boolean>();
prompt.get(dest, function (err, result) {
handleError(err);
config.dest = result.dest;
dfd.resolve(true);
});
return dfd.promise;
}
示例7: promptForWidths
function promptForWidths(): Q.IPromise<boolean> {
var dfd = Q.defer<boolean>();
prompt.get(widths, function (err, result) {
handleError(err);
config.widths = result.widths.split(",");
dfd.resolve(true);
});
return dfd.promise;
}
示例8: promptForCrawl
function promptForCrawl(): Q.IPromise<boolean> {
var dfd =Q.defer<boolean>();
prompt.get(crawl, function(err, result){
handleError(err);
var crawl = (result.crawl === "y" || result.crawl === "yes");
config.urls[Object.keys(config.urls)[0]].crawl = crawl;
dfd.resolve(true);
});
return dfd.promise;
}
示例9: libraryNameCreate
/**
* Asks the user for the name of the library if it has been cloned into the
* default directory, or if they want a different name to the one suggested
*/
function libraryNameCreate() {
_prompt.get(_promptSchemaLibraryName, (err: any, res: any) => {
if (err) {
console.log(colors.red("Sorry, there was an error building the workspace :("))
removeItems()
process.exit(1)
return
}
setupLibrary(res.library)
})
}
示例10: function
function(callback) {
var repo = repos.shift();
console.log("Repository [%s]", repo.name);
prompt.get(InstallSchema, function(err, result) {
// don't break execution for an error at the prompt, assume no
if(err) return console.error(err);
if(result.install.charAt(0) === "y") {
resultingRepos.push(repo);
}
callback(null);
});
},