Skip to content

Commit

Permalink
Add .prettierrc.json
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKain committed Apr 17, 2021
1 parent b5f93f3 commit 98cb00b
Show file tree
Hide file tree
Showing 6 changed files with 1,393 additions and 68 deletions.
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 120
}
42 changes: 20 additions & 22 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#! /usr/bin/env node
"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
Expand All @@ -17,7 +15,7 @@ var pkg = require('../package.json');
var version = pkg.version;
var notifier = updateNotifier({
pkg: pkg,
updateCheckInterval: 1000 * 60 * 60
updateCheckInterval: 1000 * 60 * 60,
});
var Subclean = /** @class */ (function () {
function Subclean() {
Expand Down Expand Up @@ -69,12 +67,12 @@ var Subclean = /** @class */ (function () {
'| --clean | ( -c ) | Delete the input file before writing the output |',
'| --debug | | Display extra debugging information |',
'| --version | ( -v ) | Print the current package version |',
'| --help | | Show the text you\'re reading now |',
'| --no-check | ( -n ) | Don\'t check for a new package version |',
"| --help | | Show the text you're reading now |",
"| --no-check | ( -n ) | Don't check for a new package version |",
'| --silent | ( -s ) | Silent mode. Nothing logged to console |',
'|---------------------------------------------------------------------------|',
'| Example: subclean subtitle.srt -o cleaned.en.srt |',
'|---------------------------------------------------------------------------|'
'|---------------------------------------------------------------------------|',
].join('\n'), false);
};
/**
Expand All @@ -85,15 +83,15 @@ var Subclean = /** @class */ (function () {
this.help();
// Parse the required arguments from short or long parameters
this.args = {
input: (argv._.shift() || argv.i || argv['input'] || ''),
output: (argv.o || argv['output'] || ''),
overwrite: (!!argv.w || !!argv.overwrite),
clean: (!!argv.c || !!argv.clean),
debug: (!!argv.debug),
help: (!!argv.help),
nocheck: (!!argv.n || !!argv['no-check']),
silent: (!!argv.silent || !!argv.s),
version: (!!argv.version || !!argv.v)
input: argv._.shift() || argv.i || argv['input'] || '',
output: argv.o || argv['output'] || '',
overwrite: !!argv.w || !!argv.overwrite,
clean: !!argv.c || !!argv.clean,
debug: !!argv.debug,
help: !!argv.help,
nocheck: !!argv.n || !!argv['no-check'],
silent: !!argv.silent || !!argv.s,
version: !!argv.version || !!argv.v,
};
// Debugging
if (this.args.debug) {
Expand Down Expand Up @@ -156,7 +154,7 @@ var Subclean = /** @class */ (function () {
return;
try {
var items = JSON.parse(fs.readFileSync(path_1.join(this.fd, filter + ".json"), 'utf-8'));
this.blacklist = __spreadArrays(this.blacklist, items);
this.blacklist = __spreadArray(__spreadArray([], this.blacklist), items);
this.loaded.push(filter);
if (this.args.debug) {
this.log("[Filter] Added " + items.length + " items from filter " + filter);
Expand All @@ -172,7 +170,7 @@ var Subclean = /** @class */ (function () {
* @param items Array of stings
*/
Subclean.prototype.addBlacklistItems = function (items) {
this.blacklist = __spreadArrays(this.blacklist, items);
this.blacklist = __spreadArray(__spreadArray([], this.blacklist), items);
this.log("[Filter] Added " + items.length + " custom blacklist items");
};
/**
Expand Down Expand Up @@ -222,7 +220,7 @@ var Subclean = /** @class */ (function () {
fs.unlinkSync(this.args.input);
// Stringify cleaned subtitles
var cleaned = subtitle_1.stringifySync(nodes, {
format: this.args.ext
format: this.args.ext,
});
// Write the file
if (hits > 0) {
Expand Down
Loading

0 comments on commit 98cb00b

Please sign in to comment.