Kaynağa Gözat

travis xsel test (#4)

* Replace copy-paste with clipboardy
* install xsel for test in travis

close https://github.com/lesspass/lesspass/issues/153
pull/342/head
Guillaume Vincent 7 yıl önce
committed by GitHub
ebeveyn
işleme
dc34c1eff3
3 değiştirilmiş dosya ile 25 ekleme ve 13 silme
  1. +8
    -1
      .travis.yml
  2. +16
    -11
      cli.js
  3. +1
    -1
      package.json

+ 8
- 1
.travis.yml Dosyayı Görüntüle

@@ -1,5 +1,12 @@
language: node_js
node_js:
- '6'
- '5'
- '4'
addons:
apt:
packages:
- xsel
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3

+ 16
- 11
cli.js Dosyayı Görüntüle

@@ -1,6 +1,6 @@
#!/usr/bin/env node
'use strict';
const copyPaste = require('copy-paste');
const clipboardy = require('clipboardy');
const meow = require('meow');
const LessPass = require('lesspass');
const read = require('read');
@@ -8,7 +8,7 @@ const chalk = require('chalk');

const helpMessage = `
Usage
$ lesspass <site> <login> [masterPassword] [options]
$ lesspass <site> <login> [masterPassword] [options]

Options
-l add lowercase in password
@@ -23,22 +23,22 @@ const helpMessage = `

--length, -L int (default 16)
--counter, -c int (default 1)
--clipboard, -C copy generated password to clipboard rather than displaying it.
Need pbcopy (OSX), xclip (Linux) or clip (Windows).
Need pbcopy (OSX), xsel (Linux) or clip (Windows).

Examples
# no symbols
$ lesspass lesspass.com contact@lesspass.com password --no-symbols
$ lesspass lesspass.com contact@lesspass.com password --no-symbols
OlfK63bmUhqrGODR
# no symbols shortcut
$ lesspass lesspass.com contact@lesspass.com password -lud
OlfK63bmUhqrGODR
# only digits and length of 8
$ lesspass lesspass.com contact@lesspass.com -d -L8
master password:
master password:
75837019`;

const cli = meow(helpMessage, {
@@ -51,10 +51,15 @@ function calcPassword(site, login, masterPassword, passwordProfile) {
LessPass.generatePassword(site, login, masterPassword, passwordProfile)
.then(function (generatedPassword) {
if (passwordProfile.clipboard) {
copyPaste.copy(generatedPassword, function () {
console.log("Copied to clipboard");
clipboardy.write(generatedPassword)
.then(() => {
console.log('Copied to clipboard');
process.exit();
});
}).catch(err => {
console.error(chalk.red('Copy failed.'));
console.error(err.message);
process.exit(1);
});
} else {
console.log(generatedPassword);
process.exit();


+ 1
- 1
package.json Dosyayı Görüntüle

@@ -22,7 +22,7 @@
},
"dependencies": {
"chalk": "^1.1.3",
"copy-paste": "1.3.0",
"clipboardy": "^0.1.2",
"lesspass": "6.0.0",
"meow": "3.7.0",
"read": "1.0.7"


Yükleniyor…
İptal
Kaydet