src/commands/init/index.js
async function showListOfTemplates() {
    const spinner = ora('Fetching list of official templates').start();
    const templates = await getOfficialTemplates();
    spinner.stop();

    const choices = templates.map((template) => ({
        name: `${template.name}${template.description && ' - ' + template.description}`,
        short: template.name,
        value: template.full_name,
    }));

    const { option } = await inquirer.prompt([{
        type: 'rawlist',
        name: 'option',
        message: 'Select a template',
        choices,
    }]);

    return option;
}
async function showListOfTemplates() {
    const spinner = ora('Fetching list of official templates').start();
    const templates = await getOfficialTemplates();
    spinner.stop();

    const choices = templates.map((template) => ({
        name: `${template.name}${template.description && ' - ' + template.description}`,
        short: template.name,
        value: template.full_name,
    }));

    const { option } = await inquirer.prompt([{
        type: 'rawlist',
        name: 'option',
        message: 'Select a template',
        choices,
    }]);

    return option;
}
async function showListOfTemplates ( ) { const spinner = ora ( 'Fetching list of official templates' ) . start ( ) ; const templates = await getOfficialTemplates ( ) ; spinner . stop ( ) ; const choices = templates . map ( ( template ) => ( { name : ` ${ template . name } ${ template . description && ' - ' + template . description } ` , short : template . name , value : template . full_name , } ) ) ; const { option } = await inquirer . prompt ( [ { type : 'rawlist' , name : 'option' , message : 'Select a template' , choices , } ] ) ; return option ; }
TODO Handle if we get 403 from GitHub
TODO Handle if we get 403 from GitHub