UNPKG

weather-cli-starter

Version:

Console interface for getting weather condition

33 lines (27 loc) 954 B
import chalk from 'chalk' import dedent from 'dedent-js' const printError = (error) => { console.log(chalk.white.bgRed(' ERROR ') + ' ' + error) } const printSuccess = (message) => { console.log(chalk.white.bgGreen(' SUCCESS ') + ' ' + message) } const printHelp = () => { console.log( dedent(`${chalk.bgBlue(' HELP ')} Без параметров - вывод погоды -s [CITY] для установки города -h для вывода помощи -t [TOKEN] для сохранения токена `)) } const printForecast = (weather) => { console.log(dedent(` ${chalk.magentaBright(`Погода ${weather.name}`)} Сейчас ${weather.weather[0].description} Температура ${weather.main.temp} °C Давление ${weather.main.pressure} Па Скорость ветра ${weather.wind.speed} м/с `)); } export { printError, printSuccess, printHelp, printForecast }