1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

add export command

This commit is contained in:
Kyle Spearrin
2018-05-17 10:58:30 -04:00
parent b2f8858c26
commit 36421c9144
8 changed files with 137 additions and 14 deletions

View File

@@ -1,8 +1,23 @@
import * as fs from 'fs';
import * as path from 'path';
import { CipherView } from 'jslib/models/view/cipherView';
import { CollectionView } from 'jslib/models/view/collectionView';
import { FolderView } from 'jslib/models/view/folderView';
export class CliUtils {
static mkdirpSync(targetDir: string, mode = 755, relative = false, relativeDir: string = null) {
const initialDir = path.isAbsolute(targetDir) ? path.sep : '';
const baseDir = relative ? (relativeDir != null ? relativeDir : __dirname) : '.';
targetDir.split(path.sep).reduce((parentDir, childDir) => {
const dir = path.resolve(baseDir, parentDir, childDir);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, mode);
}
return dir;
}, initialDir);
}
static readStdin(): Promise<string> {
return new Promise((resolve, reject) => {
let input: string = '';