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


TypeScript promptly.prompt函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。