-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
25 lines (22 loc) · 839 Bytes
/
server.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
#!/usr/bin/env node
const program = require('commander')
const chalk = require('chalk')
const clipboardy = require('clipboardy')
const createPass = require('./utils/createPass')
const savePassword = require('./utils/savePass')
program.version('1.0.0').description('Pass generator')
program
.option('-l, --length <number>', 'length of password', '8')
.option('-s, --save', 'save password to passwords.txt')
.option('-nn, --no-numbers', 'remove numbers')
.option('-ns, --no-symbols', 'remove symbols')
.parse()
const {length,save,numbers,symbols} = program.opts()
//generate password
const pass = createPass(length,numbers,symbols)
if(save){
savePassword(pass)
}
clipboardy.writeSync(pass)
console.log(chalk.blue('Password is ')+ chalk.bold(pass))
console.log(chalk.green('Your new password is now copied to the clipboard'))