Azure / pcs-cli

A CLI for deploying Azure IoT PCS
MIT License
33 stars 37 forks source link

Use input parameters instead of asking the user again. #460

Closed sakimsft closed 5 years ago

sakimsft commented 5 years ago

Description and Motivation

This is the fix for issue - https://github.com/Azure/pcs-cli/issues/444

  1. Take solutionName question out from Question constructor to avoid Question instance always has solutionName question

  2. Move answer validation code from Question to Validator so that it can run validation not only Answers but also input parameters

  3. Add checking code if input parameter already has values for below parameters and if it has, don't ask again.

    • solutionName
    • subscriptionId
    • location
    • username
    • password. Note: other parameters have either default values or get values from different source without asking questions to the user.
  4. Don't call UI close() until the end of the program. close() unregisters event listener and hence it could cause a prompt waiting an event without listeners and hang.

  5. We can do code refactoring in the future.
    This change keeps the current code structure and most of logic to minimize the risk and although it looks pretty big change, lots of them are white spaces or moving the existing code to different location.

Change type

Checklist:


This change is Reviewable