1P logs
This commit is contained in:
parent
4f3fce48e1
commit
6a240a12b4
3
js/1password_logs/.gitignore
vendored
Normal file
3
js/1password_logs/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/log.txt
|
||||
/out/
|
||||
.DS_Store
|
38
js/1password_logs/index.js
Normal file
38
js/1password_logs/index.js
Normal file
@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs/promises');
|
||||
|
||||
async function outputSets(sets) {
|
||||
const promises = [];
|
||||
for (const [ name, set ] of Object.entries(sets)) {
|
||||
const sorted = [ ...set ].sort();
|
||||
const data = sorted.join('\n') + '\n';
|
||||
promises.push(
|
||||
fs.writeFile(`./out/${name}.txt`, data)
|
||||
)
|
||||
}
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
(async () => {
|
||||
|
||||
const source = (await fs.readFile('./log.txt')).toString();
|
||||
const sourcePathRegex = /op-[a-z0-9-]*\/[a-z0-9-_\/]*.[a-z]*:?[0-9]{0,}/g;
|
||||
const matches = source.match(sourcePathRegex);
|
||||
|
||||
let roots = new Set();
|
||||
let paths = new Set();
|
||||
let types = new Set();
|
||||
|
||||
for (const match of matches) {
|
||||
const root = match.split('/')[0];
|
||||
roots.add(root);
|
||||
const path = match.split(':')[0];
|
||||
paths.add(path);
|
||||
const type = match.split('.')[1].split(':')[0];
|
||||
types.add(type);
|
||||
}
|
||||
|
||||
outputSets({ roots, paths, types });
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user