bcup-cli 1.3.3 → 1.3.5

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.
package/bin/bcup-cli CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/bin/bash
2
- exec npx tsx src/cli.ts "$@"
2
+ exec node "$(dirname "$0")/../dist/cli.js" "$@"
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function cli(args: string[]): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAwB,MAAM,WAAW,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,MAAM,UAAU,GAAG,CAAC,IAAc;IAChC,MAAM,OAAO,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IACrC,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,GAAG,OAAO,EAAE,uBAAuB,CAAC;IAEzE,MAAM,MAAM,GAAG,UAA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AAM,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAC5G,CAAC;AAED,SAAS,UAAU,CAAC,MAAc,EAAE,WAAmB;IACrD,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAEzC,IAAI,GAAG,CAAC;IACR,IAAI,SAAS,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAC5G,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,yBAAyB,CAAC,OAAY;IAC9C,MAAM,IAAI,GAAG,GAAG,CACd;QACE,SAAS,EAAE,OAAO;QAClB,aAAa,EAAE,MAAM;QACrB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,aAAa;KACpB,EACD;QACE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;KACvB,CACF,CAAC;IACF,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK;QAC/B,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC;KAC9B,CAAC;AACH,CAAC;AAED,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "bcup-cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Lightweight Buttercup password manager cli",
5
5
  "type": "module",
6
6
  "bin": {
7
- "bcup-cli": "dist/cli.js"
7
+ "bcup-cli": "bin/bcup-cli"
8
8
  },
9
- "main": "index.js",
9
+ "main": "dist/cli.js",
10
10
  "scripts": {
11
11
  "build": "tsc",
12
12
  "prepare": "npm run build",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "files": [
16
16
  "bin/",
17
- "src"
17
+ "dist"
18
18
  ],
19
19
  "keywords": [
20
20
  "buttercup",
package/src/cli.js DELETED
@@ -1,119 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.cli = cli;
8
- const arg_1 = __importDefault(require("arg"));
9
- const flatten_1 = __importDefault(require("lodash/flatten"));
10
- const uniqBy_1 = __importDefault(require("lodash/uniqBy"));
11
- const package_json_1 = require("../package.json");
12
- const buttercup_1 = require("buttercup");
13
- const os_1 = require("os");
14
- const clipboardy_1 = __importDefault(require("clipboardy"));
15
- const chalk_1 = __importDefault(require("chalk"));
16
- const prompt_sync_1 = __importDefault(require("prompt-sync"));
17
- const prompt_sync_history_1 = __importDefault(require("prompt-sync-history"));
18
- function cli(args) {
19
- const options = parseArgumentsIntoOptions(args);
20
- const debug = options.debug || false;
21
- if (debug)
22
- console.log(args);
23
- const bcupFile = options.bcupPath || `${(0, os_1.homedir)()}/.bcup-cli/vault.bcup`;
24
- const prompt = (0, prompt_sync_1.default)({
25
- history: (0, prompt_sync_history_1.default)() //open history file
26
- });
27
- console.log(`= ${package_json_1.name} v${package_json_1.version} (${package_json_1.description}) =`);
28
- console.log(`author: ${package_json_1.author}`);
29
- console.log(`license: ${package_json_1.license}`);
30
- console.log(`repository: ${package_json_1.repository}\n`);
31
- const password = prompt('Vault password: ', { echo: '*' });
32
- if (password == undefined || password.length == 0)
33
- return;
34
- (0, buttercup_1.init)();
35
- const datasourceCredentials = buttercup_1.Credentials.fromDatasource({
36
- path: bcupFile
37
- }, password);
38
- const fileDatasource = new buttercup_1.FileDatasource(datasourceCredentials);
39
- const credentials = buttercup_1.Credentials.fromPassword(password);
40
- let num;
41
- let entries;
42
- let titleSearch;
43
- let promptText;
44
- try {
45
- fileDatasource
46
- .load(credentials)
47
- .then(({ format, history }) => buttercup_1.Vault.createFromHistory(history, format))
48
- .then(vault => {
49
- do {
50
- console.log("\n");
51
- promptText = `Search text in folder or title. You can use RegExp (${titleSearch}): `;
52
- titleSearch = prompt(promptText, titleSearch);
53
- prompt.history.save();
54
- const re = new RegExp(titleSearch, 'i');
55
- entries = vault.findEntriesByProperty('title', re);
56
- const groups = vault.findGroupsByTitle(re);
57
- const groupEntries = groups.map(group => group.getEntries());
58
- entries = (0, flatten_1.default)(groupEntries).concat(entries);
59
- if (debug)
60
- console.log(entries);
61
- entries = (0, uniqBy_1.default)(entries, entry => entry.id);
62
- console.log('0 exit');
63
- entries.forEach((entry, idx) => {
64
- const title = emphSearch(entry.getProperty('title'), titleSearch);
65
- const username = entry.getProperty('username');
66
- const url = entry.getProperty('URL');
67
- const group = emphSearch(entry.getGroup().getTitle(), titleSearch);
68
- const sep = ` ${chalk_1.default.bold('|')} `;
69
- console.log(`${idx + 1} ${group}${chalk_1.default.bold('->')}${title}${sep}url: ${url}${sep}username: ${username}`);
70
- });
71
- console.log("\n");
72
- do {
73
- num = prompt('Select entry to copy or press enter to search again: ');
74
- if (debug)
75
- console.log('num: "' + num + '"');
76
- if (invalidSelection(num, entries.length)) {
77
- console.log(`wrong selection (0-${entries.length})`);
78
- }
79
- if (num === '0')
80
- return;
81
- } while (invalidSelection(num, entries.length));
82
- if (num === '')
83
- continue;
84
- const pass = entries[num - 1].getProperty('password');
85
- clipboardy_1.default.writeSync(pass);
86
- } while (true);
87
- });
88
- }
89
- catch (error) {
90
- console.error(error);
91
- }
92
- }
93
- function invalidSelection(num, max) {
94
- return num == undefined || (num.length > 0 && (!num.match(/\d+/) || num > max || num < 0));
95
- }
96
- function emphSearch(string, titleSearch) {
97
- const re = new RegExp(titleSearch, 'ig');
98
- let res;
99
- let newString = string;
100
- while ((res = re.exec(string)) !== null) {
101
- newString = newString.slice(0, res.index) + chalk_1.default.red(res[0]) + newString.slice(res.index + res[0].length);
102
- }
103
- return newString;
104
- }
105
- function parseArgumentsIntoOptions(rawArgs) {
106
- const args = (0, arg_1.default)({
107
- '--debug': Boolean,
108
- '--bcup-path': String,
109
- '-d': '--debug',
110
- '-b': '--bcup-path',
111
- }, {
112
- argv: rawArgs.slice(2),
113
- });
114
- return {
115
- debug: args['--debug'] || false,
116
- bcupPath: args['--bcup-path'],
117
- };
118
- }
119
- cli(process.argv);
package/src/cli.ts DELETED
@@ -1,124 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import arg from 'arg';
4
- import flatten from 'lodash/flatten';
5
- import uniqBy from 'lodash/uniqBy';
6
- import { name, version, description, author, license, repository } from '../package.json';
7
- import { Vault, FileDatasource, Credentials, init, DatasourceLoadedData } from 'buttercup';
8
- import { homedir } from 'os';
9
- import clipboardy from 'clipboardy'
10
- import chalk from 'chalk'
11
- import promptSync from 'prompt-sync';
12
- import history from 'prompt-sync-history';
13
-
14
- export function cli(args: string[]): void {
15
- const options = parseArgumentsIntoOptions(args);
16
- const debug = options.debug || false;
17
- if (debug) console.log(args);
18
- const bcupFile = options.bcupPath || `${homedir()}/.bcup-cli/vault.bcup`;
19
-
20
- const prompt = promptSync({
21
- history: history() //open history file
22
- });
23
-
24
- console.log(`= ${name} v${version} (${description}) =`);
25
- console.log(`author: ${author}`);
26
- console.log(`license: ${license}`);
27
- console.log(`repository: ${repository}\n`);
28
-
29
- const password = prompt('Vault password: ', { echo: '*' })
30
- if (password == undefined || password.length == 0) return
31
-
32
- init();
33
- const datasourceCredentials = Credentials.fromDatasource({
34
- type: 'file',
35
- path: bcupFile
36
- }, password)
37
- const fileDatasource = new FileDatasource(datasourceCredentials);
38
-
39
- const credentials = Credentials.fromPassword(password);
40
-
41
- let num;
42
- let entries;
43
- let titleSearch: string;
44
- let promptText;
45
- try {
46
- fileDatasource
47
- .load(credentials)
48
- .then(({ history }: DatasourceLoadedData) => Vault.createFromHistory(history))
49
- .then(vault => {
50
- do {
51
- console.log("\n");
52
- promptText = `Search text in folder or title. You can use RegExp (${titleSearch}): `
53
- titleSearch = prompt(promptText, titleSearch);
54
- const re = new RegExp(titleSearch, 'i');
55
- entries = vault.findEntriesByProperty('title', re);
56
- const groups = vault.findGroupsByTitle(re);
57
- const groupEntries = groups.map(group => group.getEntries());
58
- entries = flatten(groupEntries).concat(entries);
59
- if (debug) console.log(entries);
60
- entries = uniqBy(entries, entry => entry.id);
61
- console.log('0 exit');
62
- entries.forEach((entry, idx) => {
63
- const title = emphSearch(String(entry.getProperty('title')), titleSearch);
64
- const username = entry.getProperty('username');
65
- const url = entry.getProperty('URL');
66
- const group = emphSearch(entry.getGroup().getTitle(), titleSearch);
67
- const sep = ` ${chalk.bold('|')} `
68
- console.log(`${idx + 1} ${group}${chalk.bold('->')}${title}${sep}url: ${url}${sep}username: ${username}`);
69
- });
70
-
71
- console.log("\n");
72
- do {
73
- num = prompt('Select entry to copy or press enter to search again: ')
74
- if (debug) console.log('num: "'+ num + '"');
75
- if (invalidSelection(num, entries.length)) {
76
- console.log(`wrong selection (0-${entries.length})`)
77
- }
78
- if (num === '0') return;
79
- } while (invalidSelection(num, entries.length))
80
- if (num === '') continue;
81
- const pass = entries[Number(num) - 1].getProperty('password');
82
- clipboardy.writeSync(String(pass));
83
- } while (true)
84
- });
85
- }
86
- catch(error) {
87
- console.error(error);
88
- }
89
- }
90
-
91
- function invalidSelection(num: string, max: number) {
92
- return num == undefined || (num.length > 0 && (!num.match(/\d+/) || Number(num) > max || Number(num) < 0))
93
- }
94
-
95
- function emphSearch(string: string, titleSearch: string) {
96
- const re = new RegExp(titleSearch, 'ig');
97
-
98
- let res;
99
- let newString = string;
100
- while ((res = re.exec(string)) !== null) {
101
- newString = newString.slice(0, res.index) + chalk.red(res[0]) + newString.slice(res.index + res[0].length)
102
- }
103
- return newString;
104
- }
105
-
106
- function parseArgumentsIntoOptions(rawArgs: any) {
107
- const args = arg(
108
- {
109
- '--debug': Boolean,
110
- '--bcup-path': String,
111
- '-d': '--debug',
112
- '-b': '--bcup-path',
113
- },
114
- {
115
- argv: rawArgs.slice(2),
116
- }
117
- );
118
- return {
119
- debug: args['--debug'] || false,
120
- bcupPath: args['--bcup-path'],
121
- };
122
- }
123
-
124
- cli(process.argv);
@@ -1,87 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import arg from 'arg';
4
- import { flatten, uniqBy } from 'lodash';
5
-
6
- export function cli(args) {
7
- const options = parseArgumentsIntoOptions(args);
8
- const debug = options.debug || false;
9
- if (debug) console.log(args);
10
- const homedir = require('os').homedir();
11
- const bcupFile = options.bcupPath || `${homedir}/.bcup-cli/vault.bcup`;
12
-
13
- const { Vault, FileDatasource, Credentials, init, Search } = require('buttercup');
14
- const clipboardy = require('clipboardy');
15
- const prompt = require('prompt-sync')();
16
- const password = prompt('Vault password: ', { echo: '*' })
17
-
18
- init();
19
- const datasourceCredentials = Credentials.fromDatasource({
20
- path: bcupFile
21
- }, password)
22
- const fileDatasource = new FileDatasource(datasourceCredentials);
23
-
24
- const credentials = Credentials.fromPassword(password);
25
-
26
- let num;
27
- let entries;
28
- try {
29
- fileDatasource
30
- .load(credentials)
31
- .then(({ format, history }) => Vault.createFromHistory(history, format))
32
- .then(async vault => {
33
- do {
34
- const search = new Search([vault]);
35
- const titleSearch = prompt('Search text (in folder or title): ')
36
- entries = await search.prepare().then(
37
- () => {
38
- console.log("\n");
39
- return search.searchByTerm(titleSearch);
40
- }
41
- );
42
- const re = new RegExp(titleSearch, 'i');
43
- const groups = vault.findGroupsByTitle(re);
44
- const groupEntries = groups.map(group => group.getEntries());
45
- entries = flatten(groupEntries).concat(entries);
46
- if (debug) console.log(entries);
47
- entries = uniqBy(entries, entry => entry.id);
48
- console.log('0 exit');
49
- entries.forEach((entry, idx) => {
50
- const title = entry.getProperty('title');
51
- const username = entry.getProperty('username');
52
- const url = entry.getProperty('URL');
53
- const group = entry.getGroup().getTitle();
54
- console.log(`${idx + 1} ${group} / ${title} | url: ${url} | username: ${username}`);
55
- });
56
-
57
- console.log("\n");
58
- num = prompt('Select entry to copy or enter for search again: ')
59
- if (debug) console.log(num);
60
- } while (!num.length)
61
- if (num == 0) return;
62
- const pass = entries[num - 1].getProperty('password');
63
- clipboardy.writeSync(pass);
64
- });
65
- }
66
- catch(error) {
67
- console.error(error);
68
- }
69
- }
70
-
71
- function parseArgumentsIntoOptions(rawArgs) {
72
- const args = arg(
73
- {
74
- '--debug': Boolean,
75
- '--bcup-path': String,
76
- '-d': '--debug',
77
- '-b': '--bcup-path',
78
- },
79
- {
80
- argv: rawArgs.slice(2),
81
- }
82
- );
83
- return {
84
- debug: args['--debug'] || false,
85
- bcupPath: args['--bcup-path'],
86
- };
87
- }