diff --git a/npm/packs/client-generator/src/index.ts b/npm/packs/client-generator/src/index.ts index e5d418ec92..e98db92601 100644 --- a/npm/packs/client-generator/src/index.ts +++ b/npm/packs/client-generator/src/index.ts @@ -1,40 +1,29 @@ #!/usr/bin/env node import chalk from 'chalk'; -import path from 'path'; import commander from 'commander'; +import ora from 'ora'; import { axiosInstance } from './utils/axios'; const clear = require('clear'); const figlet = require('figlet'); clear(); -console.log( - chalk.red( - figlet.textSync('abp', { horizontalLayout: 'full' }) - ) -); +console.log(chalk.red(figlet.textSync('ABP', { horizontalLayout: 'full' }))); commander .version('0.0.1') - .description("An example CLI for ordering pizza's") - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese ', 'Add the specified type of cheese [marble]') - .option('-C, --no-cheese', 'You do not want any cheese') + .description('ABP Client Generator') + .option('-u, --ui', 'UI option (Angular)') .parse(process.argv); - if (!process.argv.slice(2).length) { - commander.outputHelp(); - } +if (!process.argv.slice(2).length) { + commander.outputHelp(); + process.exit(1); +} - console.log('you ordered a pizza with:'); - if (commander.peppers) console.log(' - peppers'); - if (commander.pineapple) console.log(' - pineapple'); - if (commander.bbq) console.log(' - bbq'); - const cheese: string = true === commander.cheese ? 'marble' : commander.cheese || 'no'; - console.log(' - %s cheese', cheese); - - console.log((async () => { - console.log(await axiosInstance.get('https://swapi.co/api/people/1')) -})()) \ No newline at end of file +const loading = ora('Waiting for API response... \n'); +loading.start(); +(async function() { + const data = await axiosInstance.get('a'); + loading.stop(); +})();