bcup-cli 1.0.14 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/cli.ts +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bcup-cli",
3
- "version": "1.0.14",
3
+ "version": "1.1.2",
4
4
  "description": "Lightweight Buttercup password manager cli",
5
5
  "bin": {
6
6
  "bcup-cli": "bin/bcup-cli"
@@ -19,7 +19,7 @@
19
19
  "cli",
20
20
  "bcup-cli"
21
21
  ],
22
- "author": "Ignacio Aliende García",
22
+ "author": "Ignacio Aliende García <ialiendeg@gmail.com>",
23
23
  "license": "MIT",
24
24
  "repository": "https://github.com/Usabi/bcup-cli",
25
25
  "dependencies": {
package/src/cli.ts CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import arg from 'arg';
4
4
  import { flatten, uniqBy } from 'lodash';
5
+ import { name, version, description, author, license, repository } from '../package.json';
5
6
 
6
7
  export function cli(args) {
7
8
  const options = parseArgumentsIntoOptions(args);
@@ -14,6 +15,12 @@ export function cli(args) {
14
15
  const clipboardy = require('clipboardy');
15
16
  const chalk = require('chalk');
16
17
  const prompt = require('prompt-sync')();
18
+
19
+ console.log(`= ${name} v${version} (${description}) =`);
20
+ console.log(`author: ${author}`);
21
+ console.log(`license: ${license}`);
22
+ console.log(`repository: ${repository}\n`);
23
+
17
24
  const password = prompt('Vault password: ', { echo: '*' })
18
25
  if (password == undefined || password.length == 0) return
19
26
 
@@ -35,7 +42,7 @@ export function cli(args) {
35
42
  do {
36
43
  console.log("\n");
37
44
  const titleSearch = prompt('Search text in folder or title. You can use RegExp: ')
38
- const re = new RegExp(titleSearch, 'ig');
45
+ const re = new RegExp(titleSearch, 'i');
39
46
  entries = vault.findEntriesByProperty('title', re);
40
47
  const groups = vault.findGroupsByTitle(re);
41
48
  const groupEntries = groups.map(group => group.getEntries());
@@ -44,10 +51,10 @@ export function cli(args) {
44
51
  entries = uniqBy(entries, entry => entry.id);
45
52
  console.log('0 exit');
46
53
  entries.forEach((entry, idx) => {
47
- const title = emphSearch(entry.getProperty('title'), re);
54
+ const title = emphSearch(entry.getProperty('title'), titleSearch);
48
55
  const username = entry.getProperty('username');
49
56
  const url = entry.getProperty('URL');
50
- const group = emphSearch(entry.getGroup().getTitle(), re);
57
+ const group = emphSearch(entry.getGroup().getTitle(), titleSearch);
51
58
  const sep = ` ${chalk.bold('|')} `
52
59
  console.log(`${idx + 1} ${group}${chalk.bold('->')}${title}${sep}url: ${url}${sep}username: ${username}`);
53
60
  });
@@ -72,8 +79,9 @@ export function cli(args) {
72
79
  }
73
80
  }
74
81
 
75
- function emphSearch(string, re) {
82
+ function emphSearch(string, titleSearch) {
76
83
  const chalk = require('chalk');
84
+ const re = new RegExp(titleSearch, 'ig');
77
85
 
78
86
  let res;
79
87
  let newString = string;