-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
cli.js
executable file
·42 lines (37 loc) · 915 Bytes
/
cli.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
import meow from 'meow';
import slugify from '@sindresorhus/slugify';
const cli = meow(`
Usage
$ slugify <string>
Options
--separator=<string> Word separator [Default: -]
--no-lowercase Don’t make the slug lowercase
--no-decamelize Don’t convert camelCase to separate words
--preserve-leading-underscore If your string starts with an underscore, it will be preserved in the slugified string
Examples
$ slugify 'Déjà Vu!'
deja-vu
$ slugify 'Unicorns & Rainbows' --separator='_'
unicorns_and_rainbows
`, {
flags: {
separator: {
type: 'string'
},
lowercase: {
type: 'boolean',
default: true
},
decamelize: {
type: 'boolean',
default: true
},
preserveLeadingUnderscore: {
type: 'boolean',
default: false
}
}
});
const [text] = cli.input;
console.log(slugify(text, cli.flags));