-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (22 loc) · 1.01 KB
/
Copy pathindex.js
File metadata and controls
25 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
const program = require("commander");
const streamToGoogleQuery = require("./lib.js");
program
.version("2.0.0", "-v, --version")
.option("-l, --length [chars]", "Minimum amount of characters in a selected sentence", 50)
.option("-n, --sentences [num]", "Amount of sentences to randomly select", 5)
.option("-r, --raw", "Write raw sentences without url-encode and with punctuation.")
.option("-p, --prefix [prefix]", "Add a prefix to the sentences", 'open "https://www.google.com/search?q=')
.option("-s, --suffix [suffix]", "Add a suffix to the sentences", '"')
.option("-P, --disable-prefix", "Removes the prefix")
.option("-S, --disable-suffix", "Removes the suffix")
.parse(process.argv);
const { disablePrefix, disableSuffix, length, prefix, raw, sentences, suffix } = program;
streamToGoogleQuery({
inputStream: process.stdin,
maximumNumberOfSentences: sentences,
minimumLengthOfSentence: length,
prefix: disablePrefix ? "" : prefix,
raw,
suffix: disableSuffix ? "" : suffix
});