當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript prompt.get函數代碼示例

本文整理匯總了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);
            });
        });
開發者ID:victorjacobs,項目名稱:chullo-client,代碼行數:28,代碼來源:configuration.ts

示例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);
			}
		});

	});
開發者ID:bitpi,項目名稱:Obsidian-Server,代碼行數:25,代碼來源:client_manager.ts

示例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)
     }
   })
 })
開發者ID:elentok,項目名稱:dotfiles,代碼行數:10,代碼來源:extension_syncer.ts

示例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;
}
開發者ID:aintgoin2goa,項目名稱:recap,代碼行數:10,代碼來源:ConfigGenerator.ts

示例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;
}
開發者ID:aintgoin2goa,項目名稱:recap,代碼行數:10,代碼來源:ConfigGenerator.ts

示例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;
}
開發者ID:aintgoin2goa,項目名稱:recap,代碼行數:10,代碼來源:ConfigGenerator.ts

示例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;
}
開發者ID:aintgoin2goa,項目名稱:recap,代碼行數:10,代碼來源:ConfigGenerator.ts

示例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;
}
開發者ID:aintgoin2goa,項目名稱:recap,代碼行數:11,代碼來源:ConfigGenerator.ts

示例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)
  })
}
開發者ID:robertrbairdii,項目名稱:typescript-library-starter,代碼行數:16,代碼來源:init.ts

示例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);
   });
 },
開發者ID:my-koop,項目名稱:installation,代碼行數:12,代碼來源:index-install.ts


注:本文中的prompt.get函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。