Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const qrenroll = require('./qrenroll');
const enroll = require('./enroll');
const generate = require('./generate');

app.version('2.0.0');
app.version('2.1.0');

if (qrenroll.has_jsqrcode) {
app.command('enroll-qrcode <qrcode>')
Expand Down Expand Up @@ -46,5 +46,6 @@ app.command('delete')

app.parse(process.argv);

if (!process.argv.slice(2).length)
app.outputHelp();
if (!process.argv.slice(2).length) {
generate(null, true)
}
25 changes: 20 additions & 5 deletions generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const pkg = require('./package.json');
const passcode = require('passcode');
const util = require('util');
const chalk = require('chalk');
const clipb = require('clipboardy');

const conf = new Configstore(pkg.name, {})

Expand All @@ -17,13 +18,27 @@ function doGenerate(label, nolabel) {
algorithm: value.algorithm || 'sha1',
step: value.step || 30
});

clipb.writeSync(token);

if (!nolabel) {
console.log(util.format(
'%s : %s',
chalk.cyan(label),
chalk.bold.green(token)));
console.log(
'\n',
util.format(
'%s: %s %s',
chalk.cyan(label),
chalk.bold.green(token),
chalk.gray(' [copied to clipboard]')
),
'\n'
);
} else {
console.log(token);
console.log(
'\n',
token,
chalk.gray(' [copied to clipboard]'),
'\n'
);
}
}

Expand Down
320 changes: 320 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"dependencies": {
"chalk": "^1.1.1",
"clipboardy": "^1.2.3",
"commander": "^2.8.1",
"configstore": "^2.1.0",
"passcode": "^1.0.2"
Expand Down