-
Notifications
You must be signed in to change notification settings - Fork 30
/
passbolt-find.js
executable file
·40 lines (38 loc) · 1.57 KB
/
passbolt-find.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
*/
const {Command} = require('commander');
const ResourceController = require('./app/controllers/resourceController.js');
const ResourceIndexView = require('./app/views/resources/index.js');
const {list} = require('./app/lib/coercion');
/**
* Passbolt Search Command
*/
(async function () {
const program = new Command();
program
.usage('[options]', 'Search and list resources')
.option('-u, --fingerprint <fingerprint>', 'The user key fingerprint to authenticate with')
.option('-p, --passphrase <passphrase>', 'The key passphrase')
.option('--columns <items>', 'Coma separated columns to display', list)
.option('-v, --verbose', 'Display additional debug information')
.parse(process.argv);
const resourceController = new ResourceController(program, process.argv);
await resourceController.loginIfNeeded();
try {
let data = await resourceController.index();
const view = new ResourceIndexView(data, program.opts().columns);
view.render();
} catch (err) {
resourceController.error(err);
}
})();