1.0.5 • Published 5 years ago
weather-cli-martapura v1.0.5
Instalasi
npm i weather-cli-martapura
atau
npx weather-cli-martapura
Konfigurasi
weather config -k={your api key} -c={your city id} -u=Celsius
buka link berikut untuk mendapatkan api key, jika belum punya akun silahkan daftar terlebih dahulu
- api keys
- cari kota
- https://openweathermap.org/city/1636022 <---- city id
Perintah
weather [command] <options>
command | description |
---|---|
now | show weather for now |
forecast | show weather forecast |
config | show weather forecast |
forecast | set API key, default city ID, default temperature units |
version | show package version |
help | show help menu for a command |
weather now <options>
options | description |
---|---|
--api-key, -k | set the API Key for OpenWeatherMap services if you haven't set it in configure method. |
--city, -c | set the City ID in OpenWeatherMap if you want to query weather data in a city different from the default one. |
--units, -u | set the temperature units if you want to read temperature in a different unit. |
weather forecast <options>
options | description |
---|---|
--api-key, -k | set the API Key for OpenWeatherMap services if you haven't set it in configure method. |
--city, -c | set the City ID in OpenWeatherMap if you want to query weather data in a city different from the default one. |
--units, -u | set the temperature units if you want to read temperature in a different unit. |
weather config <options>
options | description |
---|---|
--print, -p | print current configuration object |
--api-key, -k | *Required set the API Key for OpenWeatherMap services.* |
--city, -c | *Optional set the default City ID in OpenWeatherMap. Default: 4862034* |
--units, -u | *Optional set the default temperature units. Options: Kelvin (default), Celsius, Fahrenheit.* |
Publikasi paket npm
- buat akun baru di https://www.npmjs.com/
- jalankan perintah
npm adduser --registry=https://registry.npmjs.org/:_authToken=<token-from-npm>
-npm publish . --access=public
PENTING: pastikan nama package belum terdaftar
untuk memperbaharui package silahkan ubah version pada file package.json kemudian jalankan perintah -npm publish . --access=public
Sumber
https://codeburst.io/build-a-command-line-interface-cli-application-with-node-js-59becec90e28