本文整理汇总了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);
});
},