taraskevizer 6.0.9 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -232,30 +232,24 @@ bun add -g taraskevizer
232
232
  ## Usage
233
233
 
234
234
  ```bash
235
- tarask "планета"
235
+ tarask [options] text
236
236
  ```
237
237
 
238
- ## Options
238
+ For usage examples and options use `--help` option
239
+ (in source, content of `--help` is in [this file](./cli-help.txt))
240
+
241
+ ### "Without installation"
242
+
243
+ With npm:
244
+
245
+ ```bash
246
+ npx taraskevizer [options] text
247
+ ```
248
+
249
+ With bun:
239
250
 
240
251
  ```bash
241
- # Alpabet
242
- --latin (-l)
243
- --latin-ji (-lj)
244
- --arabic (-a)
245
- # When to replace і(i) by й(j) after vowels
246
- --jrandom (-jr)
247
- --jalways (-ja)
248
- # Replace ґ(g) by г(h) in cyrillic alphabet
249
- --h (-h)
250
- # Variations
251
- --no-variations (-nv)
252
- --first-variation-only (-fvo)
253
- # Mode
254
- --html (-html)
255
- --alphabet-only (-abc)
256
- # Other
257
- --not-escape-caps (-nec)
258
- --no-color (-nc)
252
+ bunx taraskevizer [options] text
259
253
  ```
260
254
 
261
255
  # Known bugs
package/dist/bin.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { ALPHABET, REPLACE_J, Taraskevizer, VARIATION } from "./index.js";
3
3
  import readline from "readline/promises";
4
- import { readFile } from "fs/promises";
5
4
  const prefix = "\x1B[34m[taraskevizer]\x1B[0m ";
6
5
  const printWithPrefix = (msg) => {
7
6
  process.stdout.write(prefix + msg.toString() + "\n");
@@ -9,10 +8,56 @@ const printWithPrefix = (msg) => {
9
8
  process.argv.splice(0, 2);
10
9
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
11
10
  if (checkForOptions(["-v", "--version"])) {
12
- const { version } = JSON.parse(
13
- await readFile(new URL("../package.json", import.meta.url), "utf8")
14
- );
15
- printWithPrefix(version);
11
+ printWithPrefix("6.1.0");
12
+ process.exit(0);
13
+ }
14
+ if (checkForOptions(["-h", "--help"])) {
15
+ printWithPrefix(`Usage: tarask [options] text
16
+ If text is not passed, interactive mode will be enabled
17
+
18
+ EXAMPLES
19
+
20
+ Convert and latinize a word
21
+ tarask --latin 'планета'
22
+ Will print "p\x1B[32ml\x1B[0ma\x1B[32mne\x1B[0mta"
23
+
24
+ Read from one file and write converted text to another
25
+ tarask < ./cyr-text.txt > ./lat-text.txt
26
+
27
+ Enter interactive mode
28
+ tarask
29
+ Will print "\x1B[34m[taraskevizer]\x1B[0m Enter the text:" and wait until you press Enter
30
+
31
+ OPTIONS
32
+
33
+ General:
34
+ -h --help
35
+ -v --version
36
+
37
+ Alphabet:
38
+ -l --latin
39
+ -lj --latin-ji
40
+ -a --arabic
41
+
42
+ When to replace і(i) by й(j) after vowels:
43
+ -jr --jrandom
44
+ -ja --jalways
45
+
46
+ Replace ґ(g) by г(h) in cyrillic alphabet:
47
+ --h
48
+
49
+ Variations:
50
+ -nv --no-variations
51
+ -fvo --first-variation-only
52
+
53
+ Mode (only one can be used):
54
+ -html --html
55
+ -abc --alphabet-only
56
+
57
+ Other:
58
+ -nec --not-escape-caps
59
+ -nc --no-color
60
+ `);
16
61
  process.exit(0);
17
62
  }
18
63
  const general = {};
@@ -30,6 +75,8 @@ const toHashTable = (dict) => {
30
75
  return result;
31
76
  };
32
77
  const optionDict = toHashTable([
78
+ [["--help", "-h"], () => {
79
+ }],
33
80
  [
34
81
  ["--latin", "-l"],
35
82
  () => {
@@ -67,7 +114,7 @@ const optionDict = toHashTable([
67
114
  }
68
115
  ],
69
116
  [
70
- ["--h", "-h"],
117
+ ["--h"],
71
118
  () => {
72
119
  nonHtml.h = true;
73
120
  html.g = false;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  type Dict<T = RegExp> = readonly (readonly [T, string])[];
2
- type WritableDict<T = RegExp> = [T, string][];
3
2
 
4
3
  type ModifyObjectType<T, TResultObj> = T extends object ? T extends (...args: any[]) => any ? T : TResultObj : T;
5
4
  type DeepPartialReadonly<T> = ModifyObjectType<T, {
@@ -47,7 +46,7 @@ declare const __tarask__: {
47
46
  readonly softeners: Dict;
48
47
  readonly replaceWithDict: (text: string, dict?: ExtendedDict) => string;
49
48
  readonly afterTarask: ExtendedDict;
50
- readonly noSoften: WritableDict;
49
+ readonly noSoften: Dict;
51
50
  };
52
51
  declare class Taraskevizer {
53
52
  general: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "6.0.9",
3
+ "version": "6.1.0",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",