From the course: Building Your First CLI App in Node
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Prompt the user for repository details
From the course: Building Your First CLI App in Node
Prompt the user for repository details
- [Instructor] We now have all of the prompts to authorize our user, and the authorization token can be stored from OAuth for GitHub. These user credentials will be used to create a remote repository from our CLI app. The questions in the prompt will be, what is the name of the repository to be created, provide a description of the repository, which is an optimal input for the user, and should the repository be created as a public or a private repository? So we're again going to use inquirer to prompt the user here. Let's close index.js and open the inquirer.js, which is in our lib folder. In addition to inquirer, we are going to use minimist to set some defaults for the prompts. You can see we already have that set as a require at the top of the inquirer file. Then, after the askGitHubCredentials function, below that, we're going to create a new function called askRepositoryDetails. So just like before, you're creating an object here that contains a function. And to begin with…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.