Browse Source

made this shit usable

Henry Jameson 6 years ago
parent
commit
9aaa2d706e
4 changed files with 30 additions and 24 deletions
  1. 2
    2
      package.json
  2. 16
    9
      src/index.js
  3. 7
    13
      src/makeWord.js
  4. 5
    0
      weeapass

+ 2
- 2
package.json View File

@@ -1,10 +1,10 @@
1 1
 {
2 2
   "name": "weeapass",
3
-  "version": "1.0.0",
3
+  "version": "0.9.0",
4 4
   "description": "Weeaboo password generator",
5 5
   "main": "index.js",
6 6
   "scripts": {
7
-    "test": "echo \"Error: no test specified\" && exit 1"
7
+    "start": "node src/index.js"
8 8
   },
9 9
   "repository": {
10 10
     "type": "git",

+ 16
- 9
src/index.js View File

@@ -1,15 +1,22 @@
1
+#!/usr/bin/env node
1 2
 /**
2 3
  * Module dependencies.
3 4
  */
4 5
 
5
-var program = require('commander');
6
+var program = require('commander'),
7
+    makeWord = require('./makeWord');
6 8
 
7 9
 program
8
-    .version('1.0.0')
9
-    .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
10
-
11
-console.log('you ordered a pizza with:');
12
-if (program.peppers) console.log('  - peppers');
13
-if (program.pineapple) console.log('  - pineapple');
14
-if (program.bbqSauce) console.log('  - bbq');
15
-console.log('  - %s cheese', program.cheese);
10
+    .version('0.9.0')
11
+    .option('-r, --engrish', 'Removes "l" from alphabet, as it should be.')
12
+    .option('-w, --no-w', 'Removes "w" from alphabet.')
13
+    .option('-v, --no-v', 'Removes "v" from alphabet.')
14
+    .option('-n [number]', 'Sets amount of syllables to generate in a word, default = 6.', 6)
15
+    .parse(process.argv);
16
+
17
+console.log(makeWord({
18
+    engrish: program.engrish,
19
+    noW: !program.w,
20
+    noV: !program.v
21
+}, program.N));
22
+

+ 7
- 13
src/makeWord.js View File

@@ -10,7 +10,6 @@ var _ = require('lodash'),
10 10
     ],
11 11
     consonants = {
12 12
         'b': 100,
13
-        'c': 75,
14 13
         'd': 100,
15 14
         'f': 50,
16 15
         'g': 100,
@@ -24,7 +23,7 @@ var _ = require('lodash'),
24 23
         'q': 0,
25 24
         'r': 50,
26 25
         's': 100,
27
-        't': 0,
26
+        't': 75,
28 27
         'v': 25,
29 28
         'w': 'v',
30 29
         'x': 0,
@@ -34,6 +33,12 @@ var _ = require('lodash'),
34 33
     youonConsonants = ['k', 's', 'c'],
35 34
     generateFunctions = {
36 35
         'syllable': function(vowel, consonant) {
36
+            if (vowel === 'i' && consonant === 's') {
37
+                consonant = 'sh';
38
+            }
39
+            if (vowel === 'i' && consonant === 't') {
40
+                consonant = 'ch';
41
+            }
37 42
             return consonant + vowel;
38 43
         },
39 44
         'youon': function(vowel) {
@@ -59,17 +64,6 @@ var _ = require('lodash'),
59 64
             };
60 65
         });
61 66
 
62
-        // make c2sh and c2t cross-compatible?
63
-        if (options.s2sh) {
64
-            consonants.sh = consonants.s;
65
-            consonants.ch = consonants.c;
66
-            delete consonants.s;
67
-            delete consonants.c;
68
-        }
69
-        if (options.c2t) {
70
-            consonants.t = consonants.c;
71
-            delete consonants.c;
72
-        }
73 67
         options.engrish && delete consonants.l;
74 68
         options.noW && delete consonants.w;
75 69
         options.noV && delete consonants.v;

+ 5
- 0
weeapass View File

@@ -0,0 +1,5 @@
1
+#!/usr/bin/env sh
2
+if [ ! -d "node_modules" ]; then
3
+  npm install
4
+fi
5
+node src/index.js $*