Comparing version 1.0.6 to 1.1.0
@@ -31,18 +31,20 @@ #!/usr/bin/env node | ||
const main = (baseUrl, titles, irregulars) => { | ||
const jsessionid = process.argv[2] || ''; | ||
if (jsessionid === '') { | ||
console.error('Error: No JSESSIONID argument; Locate it in Cookie'); | ||
console.error('Usage: build_ifrs_curls JSESSIONID | bash'); | ||
return 1; | ||
const prog = 'build_ifrs_curls'; | ||
const usage = process.argv[2] || ''; | ||
if (usage === '-h') { | ||
console.log(`Usage: { ${prog}; echo ${prog}::execute JSESSIONID } | bash`); | ||
console.log('Login to eIFRS and locate your JSESSIONID in Cookie.'); | ||
return; | ||
} | ||
titles.map(title => [ | ||
const curls = titles.map(title => [ | ||
baseUrl + buildRemoteName(title), | ||
buildLocalName(title), | ||
]).concat(irregulars).forEach(([url, saveas]) => { | ||
const cookie = 'Cookie: JSESSIONID=' + jsessionid; | ||
console.log(`curl -H "${cookie}" "${url}" > "${saveas}"`); | ||
}); | ||
]).concat(irregulars).map( | ||
([url, saveas]) => `curl -H "Cookie: JSESSIONID=$1" "${url}" > "${saveas}"` | ||
); | ||
return 0; | ||
console.log(prog + '::execute() {'); | ||
curls.forEach(e => { console.log(' ' + e); }); | ||
console.log('} # Call `' + prog + '::execute JSESSIONID`'); | ||
}; | ||
@@ -127,2 +129,2 @@ | ||
// Run | ||
process.exit(main(baseUrl, titles, irregulars)); | ||
main(baseUrl, titles, irregulars); |
{ | ||
"name": "curl_ifrs", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "Utility to download latest unaccompanied IFRS using curl.", | ||
"scripts": { | ||
"test": "build_ifrs_curls \\$JSESSIONID | diff -u test/output.sh -" | ||
"test": "build_ifrs_curls | diff -u test/output.sh -" | ||
}, | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -7,6 +7,6 @@ # curl_ifrs | ||
Login to eIFRS and locate your JSESSIONID in Cookie. Then, | ||
Login to eIFRS and locate your JSESSIONID in Cookie. Then, call: | ||
```bash | ||
build_ifrs_curls JSESSIONID | bash | ||
{ build_ifrs_curls; echo build_ifrs_curls::execute JSESSIONID } | bash | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115
27084