@henrottinloic/holidates
Advanced tools
Comparing version 1.0.0 to 1.1.0
20
index.js
#!/usr/bin/env node | ||
import * as search from './js/search.js'; | ||
import figlet from 'figlet'; | ||
async function main() { | ||
@@ -12,3 +12,3 @@ // console.log("Hello, Node.JS!"); | ||
let output = process.argv | ||
if(output.length != 3) | ||
if(output.length != 4) | ||
{ | ||
@@ -20,3 +20,3 @@ let tmp = new Date(); | ||
{ | ||
year = process.argv[2]; | ||
year = process.argv[3]; | ||
} | ||
@@ -26,2 +26,16 @@ search.search('get', `https://date.nager.at/api/v3/PublicHolidays/${year}/${code}`,null, search.displayHolidays); | ||
figlet.text('Holidates!', { | ||
font: 'big', | ||
horizontalLayout: 'default', | ||
verticalLayout: 'default', | ||
width: 120, | ||
whitespaceBreak: true | ||
}, function(err, data) { | ||
if (err) { | ||
console.log('Something went wrong...'); | ||
console.dir(err); | ||
return; | ||
} | ||
console.log(data); | ||
}); | ||
main(); |
import axios from "axios"; | ||
import chalk from 'chalk'; | ||
import figlet from 'figlet'; | ||
export async function search(method,url,data,callback) { | ||
@@ -20,3 +20,3 @@ return await axios ({ | ||
for (let i = 0; i < countries.length; i++) { | ||
if (countries[i].name.toLowerCase() === process.argv[1].toLowerCase()) { | ||
if (countries[i].name.toLowerCase() === process.argv[2].toLowerCase()) { | ||
return countries[i].countryCode; | ||
@@ -28,17 +28,2 @@ } | ||
export function displayHolidays(holidays) { | ||
figlet.text('Holidates!', { | ||
font: 'big', | ||
horizontalLayout: 'default', | ||
verticalLayout: 'default', | ||
width: 120, | ||
whitespaceBreak: true | ||
}, function(err, data) { | ||
if (err) { | ||
console.log('Something went wrong...'); | ||
console.dir(err); | ||
return; | ||
} | ||
console.log(data); | ||
}); | ||
for (let i = 0; i < holidays.length; i++) { | ||
@@ -45,0 +30,0 @@ console.log(`${chalk.black(holidays[i].date)} - ${chalk.yellow(holidays[i].localName.padEnd(30))} - ${chalk.red(holidays[i].name)}`); |
{ | ||
"name": "@henrottinloic/holidates", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"bin": "./index.js", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -1,1 +0,31 @@ | ||
# api-cli | ||
# api-cli | ||
## features | ||
- display holiday for a country and year | ||
## Browser Support | ||
![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | | ||
--- | --- | --- | --- | --- | --- | | ||
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ | | ||
[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios) | ||
## Installing | ||
### Package manager | ||
Using npm: | ||
```bash | ||
$ npm install axios | ||
``` | ||
## Example | ||
```bash | ||
$ npx @henrottinloic/holidates Belgium 2022 | ||
``` |
3497
31