echolist-csv2hpt
Advanced tools
Comparing version
@@ -1,1 +0,90 @@ | ||
console.log('Hello world.'); | ||
#!/usr/bin/env node | ||
var thisAPI = require('./api.js'); | ||
var clog = console.log; | ||
var params = [].concat(process.argv); | ||
params.shift(); // 'node' | ||
params.shift(); // 'echolist-csv2hpt' | ||
var inputEncoding = 'cp866'; | ||
var outputEncoding = 'cp866'; | ||
var rusMode = false; | ||
params = params.filter(function(nextParam){ | ||
if( nextParam.indexOf('--input=') === 0 ){ | ||
inputEncoding = nextParam.slice('--input='.length); | ||
return false; | ||
} else if( nextParam.indexOf('--output=') === 0 ){ | ||
outputEncoding = nextParam.slice('--output='.length); | ||
return false; | ||
} else if( nextParam.toLowerCase() === '--rus' ){ | ||
rusMode = true; | ||
return false; | ||
} | ||
return true; | ||
}); | ||
if( params.length < 2 ){ | ||
clog(''); | ||
if( rusMode ){ | ||
clog('Использование:'); | ||
clog(' echolist-csv2hpt inputCSV configHPT'); | ||
clog(''); | ||
clog('Параметры:'); | ||
clog(''); | ||
clog('inputCSV -- путь ко входному файлу (CSV-эхолисту).'); | ||
clog(''); | ||
clog('configHPT -- путь к файлу конфигурации областей эхопочты HPT.'); | ||
clog(''); | ||
clog('Необязательный параметр "--rus" предписывает приложению'); | ||
clog('употребление русских сообщений вместо английских.'); | ||
clog(''); | ||
clog('(Воздействует только на вывод в консоли, не на выходной файл.)'); | ||
clog(''); | ||
clog('Необязательные параметры "--input=CP866" и "--output=CP866"'); | ||
clog('задают кодировки входного (CSV) и выходного (HPT) файла.'); | ||
clog('Вместо CP866 в этих параметрах можно употреблять кодировки,'); | ||
clog('https://github.com/ashtuchkin/iconv-lite поддерживаемые.'); | ||
clog(''); | ||
clog('По умолчанию используется кодировка CP866 (обычная на системе'); | ||
clog('Windows в российском Фидонете, так что она употребляется'); | ||
clog('наиболее часто).'); | ||
} else { | ||
clog('Usage:'); | ||
clog(' echolist-csv2hpt inputCSV configHPT'); | ||
clog(''); | ||
clog('Parameters:'); | ||
clog(''); | ||
clog('inputCSV -- path to an input (CSV echolist) file.'); | ||
clog(''); | ||
clog('configHPT -- path to the HPT echomail area configuration file.'); | ||
clog(''); | ||
clog('An optional "--rus" parameter dictates the application to use'); | ||
clog('Russian messages instead of English.'); | ||
clog(''); | ||
clog('(It only affects console output, not the output file.)'); | ||
clog(''); | ||
clog('Optional parameters "--input=CP866" and "--output=CP866" define'); | ||
clog('the encodings of input (CSV) and output (HPT) file. Encodings'); | ||
clog('supported by https://github.com/ashtuchkin/iconv-lite can be'); | ||
clog('used in these parameters instead of CP866.'); | ||
clog(''); | ||
clog('CP866 is the default encoding (it is used by Windows users'); | ||
clog('in Russian Fidonet, which is the largest use case).'); | ||
} | ||
process.exit(1); | ||
} | ||
var filenameCSV = params[0]; | ||
var filenameHPT = params[1]; | ||
thisAPI( | ||
filenameCSV, | ||
filenameHPT, | ||
{ | ||
rusMode: rusMode, | ||
inputEncoding: inputEncoding, | ||
outputEncoding: outputEncoding | ||
} | ||
); |
{ | ||
"name": "echolist-csv2hpt", | ||
"main": "echolist-csv2hpt.js", | ||
"version": "0.0.1", | ||
"main": "api.js", | ||
"bin": "./echolist-csv2hpt.js", | ||
"preferGlobal": true, | ||
"version": "0.1.0", | ||
"description": "Copies Fidonet echomail area descriptions from a CSV echolist to an HPT areas file.", | ||
@@ -13,5 +15,9 @@ "keywords": ["Fidonet", "echomail", "echolist", "HPT", "area", "areas", "echoes"], | ||
}, | ||
"dependencies": { | ||
"array.prototype.find": "~1.0.0", | ||
"iconv-lite": "~0.4.11" | ||
}, | ||
"scripts": { | ||
"test": "jshint --verbose echolist-csv2hpt.js" | ||
"test": "jshint --verbose echolist-csv2hpt.js api.js" | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
[](https://npmjs.org/package/echolist-csv2hpt) | ||
This package (`echolist-csv2hpt`) is a CLI tool that copies Fidonet echomail area descriptions from a CSV echolist to an HPT areas file. | ||
@@ -7,4 +9,34 @@ | ||
## Installing echolist-csv2hpt | ||
[](https://npmjs.org/package/echolist-csv2hpt) | ||
### Installing as a global application | ||
* Latest packaged version: `npm install -g echolist-csv2hpt` | ||
* Latest githubbed version: `npm install -g https://github.com/Mithgol/echolist-csv2hpt/tarball/master` | ||
The application becomes installed globally and appears in the `PATH`. Then use `echolist-csv2hpt` command to run the application. | ||
### Installing as a portable application | ||
Instead of the above, download the [ZIP-packed](https://github.com/Mithgol/echolist-csv2hpt/archive/master.zip) source code of the application and unpack it to some directory. Then run `npm install --production` in that directory. | ||
You may now move that directory (for example, on a flash drive) across systems as long as they have the required version of Node.js installed. | ||
Unlike the above (`npm -g`), the application does not appear in the `PATH`, and thus you'll have to run it directly from the application's directory. You'll also have to run `node echolist-csv2hpt [parameters]` instead of `echolist-csv2hpt [parameters]`. | ||
## Testing echolist-csv2hpt | ||
[](https://travis-ci.org/Mithgol/echolist-csv2hpt) | ||
It is necessary to install [JSHint](http://jshint.com/) for testing. | ||
* You may install JSHint globally (`npm install jshint -g`) or locally (`npm install jshint` in the directory of echolist-csv2hpt). | ||
After that you may run `npm test` (in the directory of echolist-csv2hpt). Only the JS code errors are caught; the code's behaviour is not tested. | ||
## License | ||
MIT license (see the `LICENSE` file). |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
12677
405.06%8
60%194
19300%42
320%2
Infinity%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added