本文整理汇总了TypeScript中promptly.prompt函数的典型用法代码示例。如果您正苦于以下问题:TypeScript prompt函数的具体用法?TypeScript prompt怎么用?TypeScript prompt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prompt函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: save
let checkOutput = (configString: string) => {
if (configurit["output-file"]) {
save(configString, configurit["output-file"]);
}
Promptly.prompt("Output file: ", { validator: null }, (err: Error, value: string) => {
save(configString, value);
});
}
开发者ID:configurit,项目名称:configurit,代码行数:11,代码来源:configurit.ts
示例2: reject
return new Promise<AuthInfo>((resolve, reject) => {
promptly.prompt("Name: ", (error, name) => {
if (error) {
reject(error);
}
promptly.password("Password: ", (error, password) => {
resolve({username: name, password: password});
if (error) {
reject(error);
}
});
});
});
开发者ID:agentlewis,项目名称:gitlump,代码行数:13,代码来源:prompt.ts
示例3: viewNotesByText
function viewNotesByText() {
promptly.prompt('Enter note text to search for: ', (err, value) => {
console.log("Retrieving notes...");
noteApi.getAllWithText({ text: value }).then(notes => {
console.log(`Note count: ${notes.length}`);
outputNotes(notes);
}).catch(err => {
console.log(err.toString());
}).then(() => {
selection();
});
});
}
开发者ID:dsherret,项目名称:server-bridge-example,代码行数:13,代码来源:main.ts
示例4: addNote
function addNote() {
promptly.prompt('Enter note text: ', (err, value) => {
console.log("Adding note...");
noteApi.add({
creationDate: new Date(),
text: value
}).then(() => {
console.log("Added note.");
}).catch(err => {
console.log(err.toString());
}).then(() => {
selection();
})
});
}
开发者ID:dsherret,项目名称:server-bridge-example,代码行数:15,代码来源:main.ts
示例5: if
return new Promise<any>((resolve, reject) => {
let prompt = "\r\n\r\n";
if (propertyDefinition.title) {
prompt += propertyDefinition.title + "\r\n";
}
if (propertyDefinition.description) {
prompt += propertyDefinition.description + "\r\n";
}
if (currentValue !== undefined) {
prompt += "(current value: " + currentValue + ")\r\n";
}
prompt += propertyName;
Promptly.prompt(prompt + " >", (err: Error, value: string) => {
if (err) {
reject(err);
}
if (propertyDefinition.type === "boolean") {
if (value === "true" || value === "t" || value === "y" || value === "yes") {
resolve(true);
}
else {
resolve(false);
}
}
else if (propertyDefinition.type === "number") {
resolve(parseFloat(value));
}
else if(propertyDefinition.type === "integer") {
resolve(parseInt(value));
}
else {
resolve(value);
}
});
})
开发者ID:configurit,项目名称:configurit,代码行数:43,代码来源:config-generator.ts
示例6: readSchema
}
let save = (configString: string, path: string) => {
FileSystem.writeFile(path, configString, (error: Error) => {
console.log("done writing");
process.exit(0);
});
}
if(configurit["schema-location"]) {
readSchema(configurit["schema-location"]);
}
else {
Promptly.prompt("Schema location: ", { validator: null }, (err: Error, value: string) => {
//configWriter.set("name", value);
readSchema(value);
});
}
/*
let i = 0;
let counts = {
"": 0
}
let getDetails = (objectName?: string) => {
if (counts[objectName] === undefined) {
counts[objectName] = 0;
}
let properties = schemaReader.getProperties();
开发者ID:configurit,项目名称:configurit,代码行数:32,代码来源:configurit.ts
注:本文中的promptly.prompt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论